<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006-2012
(c) The GRASP Project, Glasgow University, 1992-2002

-}</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE CPP, DeriveFunctor, ExistentialQuantification, GeneralizedNewtypeDeriving,
             ViewPatterns #-}</span><span>
</span><span id="line-9"></span><span>
</span><span id="line-10"></span><span class="hs-comment">-- | Various types used during typechecking.</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Please see &quot;GHC.Tc.Utils.Monad&quot; as well for operations on these types. You probably</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- want to import it, instead of this module.</span><span>
</span><span id="line-14"></span><span class="hs-comment">--</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- All the monads exported here are built on top of the same IOEnv monad. The</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- monad functions like a Reader monad in the way it passes the environment</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- around. This is done to allow the environment to be manipulated in a stack</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- like fashion when entering expressions... etc.</span><span>
</span><span id="line-19"></span><span class="hs-comment">--</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- For state that is global and should be returned at the end (e.g not part</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- of the stack mechanism), you should use a TcRef (= IORef) to store them.</span><span>
</span><span id="line-22"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Tc.Types</span><span class="hs-special">(</span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier">TcRnIf</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier">TcRn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier">TcM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier">RnM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IfM"><span class="hs-identifier">IfM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IfL"><span class="hs-identifier">IfL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IfG"><span class="hs-identifier">IfG</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- The monad is opaque outside this module</span><span>
</span><span id="line-24"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier">TcRef</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span>        </span><span class="hs-comment">-- The environment types</span><span>
</span><span id="line-27"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#Env"><span class="hs-identifier">Env</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-28"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier">TcGblEnv</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier">TcLclEnv</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#setLclEnvTcLevel"><span class="hs-identifier">setLclEnvTcLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#getLclEnvTcLevel"><span class="hs-identifier">getLclEnvTcLevel</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#setLclEnvLoc"><span class="hs-identifier">setLclEnvLoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#getLclEnvLoc"><span class="hs-identifier">getLclEnvLoc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#IfGblEnv"><span class="hs-identifier">IfGblEnv</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IfLclEnv"><span class="hs-identifier">IfLclEnv</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-32"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#tcVisibleOrphanMods"><span class="hs-identifier">tcVisibleOrphanMods</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span>        </span><span class="hs-comment">-- Frontend types (shouldn't really be here)</span><span>
</span><span id="line-35"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#FrontendResult"><span class="hs-identifier">FrontendResult</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span>        </span><span class="hs-comment">-- Renamer types</span><span>
</span><span id="line-38"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#ErrCtxt"><span class="hs-identifier">ErrCtxt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RecFieldEnv"><span class="hs-identifier">RecFieldEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#pushErrCtxt"><span class="hs-identifier">pushErrCtxt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#pushErrCtxtSameOrigin"><span class="hs-identifier">pushErrCtxtSameOrigin</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier">ImportAvails</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#emptyImportAvails"><span class="hs-identifier">emptyImportAvails</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#plusImportAvails"><span class="hs-identifier">plusImportAvails</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-40"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#WhereFrom"><span class="hs-identifier">WhereFrom</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#mkModDeps"><span class="hs-identifier">mkModDeps</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#modDepsElts"><span class="hs-identifier">modDepsElts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span>        </span><span class="hs-comment">-- Typechecker types</span><span>
</span><span id="line-43"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#TcTypeEnv"><span class="hs-identifier">TcTypeEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcBinderStack"><span class="hs-identifier">TcBinderStack</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcBinder"><span class="hs-identifier">TcBinder</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#TcTyThing"><span class="hs-identifier">TcTyThing</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#PromotionErr"><span class="hs-identifier">PromotionErr</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-45"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#IdBindingInfo"><span class="hs-identifier">IdBindingInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ClosedTypeId"><span class="hs-identifier">ClosedTypeId</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RhsNames"><span class="hs-identifier">RhsNames</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-46"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#IsGroupClosed"><span class="hs-identifier">IsGroupClosed</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-47"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#SelfBootInfo"><span class="hs-identifier">SelfBootInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-48"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#tcTyThingCategory"><span class="hs-identifier">tcTyThingCategory</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#pprTcTyThingCategory"><span class="hs-identifier">pprTcTyThingCategory</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-49"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier">peCategory</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#pprPECategory"><span class="hs-identifier">pprPECategory</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-50"></span><span>        </span><span class="annot"><a href="GHC.Driver.Types.html#CompleteMatch"><span class="hs-identifier">CompleteMatch</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span>        </span><span class="hs-comment">-- Desugaring types</span><span>
</span><span id="line-53"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier">DsM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsLclEnv"><span class="hs-identifier">DsLclEnv</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsGblEnv"><span class="hs-identifier">DsGblEnv</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-54"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#DsMetaEnv"><span class="hs-identifier">DsMetaEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsMetaVal"><span class="hs-identifier">DsMetaVal</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#CompleteMatchMap"><span class="hs-identifier">CompleteMatchMap</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-55"></span><span>        </span><span class="annot"><a href="GHC.Driver.Types.html#mkCompleteMatchMap"><span class="hs-identifier">mkCompleteMatchMap</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#extendCompleteMatchMap"><span class="hs-identifier">extendCompleteMatchMap</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span>        </span><span class="hs-comment">-- Template Haskell</span><span>
</span><span id="line-58"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#ThStage"><span class="hs-identifier">ThStage</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#SpliceType"><span class="hs-identifier">SpliceType</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#PendingStuff"><span class="hs-identifier">PendingStuff</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-59"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#topStage"><span class="hs-identifier">topStage</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#topAnnStage"><span class="hs-identifier">topAnnStage</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#topSpliceStage"><span class="hs-identifier">topSpliceStage</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-60"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#ThLevel"><span class="hs-identifier">ThLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#impLevel"><span class="hs-identifier">impLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#outerLevel"><span class="hs-identifier">outerLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#thLevel"><span class="hs-identifier">thLevel</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-61"></span><span>        </span><span class="annot"><a href="../../ghc-boot-th/src/GHC.ForeignSrcLang.Type.html#ForeignSrcLang"><span class="hs-identifier">ForeignSrcLang</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-62"></span><span>
</span><span id="line-63"></span><span>        </span><span class="hs-comment">-- Arrows</span><span>
</span><span id="line-64"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#ArrowCtxt"><span class="hs-identifier">ArrowCtxt</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span>        </span><span class="hs-comment">-- TcSigInfo</span><span>
</span><span id="line-67"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier">TcSigFun</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigInfo"><span class="hs-identifier">TcSigInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInfo"><span class="hs-identifier">TcIdSigInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-68"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier">TcIdSigInst</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPatSynInfo"><span class="hs-identifier">TcPatSynInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-69"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#isPartialSig"><span class="hs-identifier">isPartialSig</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#hasCompleteSig"><span class="hs-identifier">hasCompleteSig</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span>        </span><span class="hs-comment">-- Misc other types</span><span>
</span><span id="line-72"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier">TcId</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSet"><span class="hs-identifier">TcIdSet</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-73"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier">NameShape</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-74"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#removeBindingShadowing"><span class="hs-identifier">removeBindingShadowing</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-75"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#getPlatform"><span class="hs-identifier">getPlatform</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-76"></span><span>
</span><span id="line-77"></span><span>        </span><span class="hs-comment">-- Constraint solver plugins</span><span>
</span><span id="line-78"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#TcPlugin"><span class="hs-identifier">TcPlugin</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginResult"><span class="hs-identifier">TcPluginResult</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginSolver"><span class="hs-identifier">TcPluginSolver</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-79"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier">TcPluginM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#runTcPluginM"><span class="hs-identifier">runTcPluginM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#unsafeTcPluginTcM"><span class="hs-identifier">unsafeTcPluginTcM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-80"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#getEvBindsTcPluginM"><span class="hs-identifier">getEvBindsTcPluginM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span>        </span><span class="hs-comment">-- Role annotations</span><span>
</span><span id="line-83"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#RoleAnnotEnv"><span class="hs-identifier">RoleAnnotEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#emptyRoleAnnotEnv"><span class="hs-identifier">emptyRoleAnnotEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#mkRoleAnnotEnv"><span class="hs-identifier">mkRoleAnnotEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-84"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#lookupRoleAnnot"><span class="hs-identifier">lookupRoleAnnot</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#getRoleAnnots"><span class="hs-identifier">getRoleAnnots</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span>        </span><span class="hs-comment">-- Linting</span><span>
</span><span id="line-87"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.html#lintGblEnv"><span class="hs-identifier">lintGblEnv</span></a></span><span>
</span><span id="line-88"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-92"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-93"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-96"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-97"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html"><span class="hs-identifier">GHC.Tc.Types.Evidence</span></a></span><span>
</span><span id="line-98"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-99"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier">TyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#tyConKind"><span class="hs-identifier">tyConKind</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-100"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.PatSyn.html"><span class="hs-identifier">GHC.Core.PatSyn</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.PatSyn.html#PatSyn"><span class="hs-identifier">PatSyn</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-101"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Lint.html"><span class="hs-identifier">GHC.Core.Lint</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Lint.html#lintAxioms"><span class="hs-identifier">lintAxioms</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-102"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Id.html#idType"><span class="hs-identifier">idType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Id.html#idName"><span class="hs-identifier">idName</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-103"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html"><span class="hs-identifier">GHC.Types.FieldLabel</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier">FieldLabel</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-104"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.UsageEnv.html"><span class="hs-identifier">GHC.Core.UsageEnv</span></a></span><span>
</span><span id="line-105"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span>
</span><span id="line-106"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html"><span class="hs-identifier">GHC.Tc.Types.Constraint</span></a></span><span>
</span><span id="line-107"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html"><span class="hs-identifier">GHC.Tc.Types.Origin</span></a></span><span>
</span><span id="line-108"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Annotations.html"><span class="hs-identifier">GHC.Types.Annotations</span></a></span><span>
</span><span id="line-109"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.InstEnv.html"><span class="hs-identifier">GHC.Core.InstEnv</span></a></span><span>
</span><span id="line-110"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html"><span class="hs-identifier">GHC.Core.FamInstEnv</span></a></span><span>
</span><span id="line-111"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html"><span class="hs-identifier">GHC.HsToCore.PmCheck.Types</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier">Deltas</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-112"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html"><span class="hs-identifier">GHC.Data.IOEnv</span></a></span><span>
</span><span id="line-113"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html"><span class="hs-identifier">GHC.Types.Name.Reader</span></a></span><span>
</span><span id="line-114"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-115"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html"><span class="hs-identifier">GHC.Types.Name.Env</span></a></span><span>
</span><span id="line-116"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html"><span class="hs-identifier">GHC.Types.Name.Set</span></a></span><span>
</span><span id="line-117"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html"><span class="hs-identifier">GHC.Types.Avail</span></a></span><span>
</span><span id="line-118"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span>
</span><span id="line-119"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html"><span class="hs-identifier">GHC.Types.Var.Env</span></a></span><span>
</span><span id="line-120"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.html"><span class="hs-identifier">GHC.Unit</span></a></span><span>
</span><span id="line-121"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-122"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span>
</span><span id="line-123"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-124"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-125"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-126"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html"><span class="hs-identifier">GHC.Data.Bag</span></a></span><span>
</span><span id="line-127"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-128"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-129"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.List.SetOps.html"><span class="hs-identifier">GHC.Data.List.SetOps</span></a></span><span>
</span><span id="line-130"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Fingerprint.html"><span class="hs-identifier">GHC.Utils.Fingerprint</span></a></span><span>
</span><span id="line-131"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-132"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html#isUnboundName"><span class="hs-identifier">isUnboundName</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-133"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.State.html"><span class="hs-identifier">GHC.Types.CostCentre.State</span></a></span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#ap"><span class="hs-identifier">ap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-136"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../containers/src/Data.Set.html#"><span class="hs-identifier">Data.Set</span></a></span><span>      </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../containers/src/Data.Set.Internal.html#Set"><span class="hs-identifier">Set</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-137"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../containers/src/Data.Set.html#"><span class="hs-identifier">Data.Set</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#sort"><span class="hs-identifier">sort</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-140"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.html#"><span class="hs-identifier">Data.Map</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.Internal.html#Map"><span class="hs-identifier">Map</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-141"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Dynamic.html#"><span class="hs-identifier">Data.Dynamic</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Dynamic.html#Dynamic"><span class="hs-identifier">Dynamic</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-142"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Typeable.html#"><span class="hs-identifier">Data.Typeable</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Typeable.html#TypeRep"><span class="hs-identifier">TypeRep</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-143"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier">mapMaybe</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-144"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.Message.html#"><span class="hs-identifier">GHCi.Message</span></a></span><span>
</span><span id="line-145"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#"><span class="hs-identifier">GHCi.RemoteTypes</span></a></span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.Tc.Errors.Hole.FitTypes.html"><span class="hs-identifier">GHC.Tc.Errors.Hole.FitTypes</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Errors.Hole.FitTypes.html#HoleFitPlugin"><span class="hs-identifier">HoleFitPlugin</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-148"></span><span>
</span><span id="line-149"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../template-haskell/src/Language.Haskell.TH.html#"><span class="hs-identifier">Language.Haskell.TH</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">TH</span></span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span class="hs-comment">-- | A 'NameShape' is a substitution on 'Name's that can be used</span><span>
</span><span id="line-152"></span><span class="hs-comment">-- to refine the identities of a hole while we are renaming interfaces</span><span>
</span><span id="line-153"></span><span class="hs-comment">-- (see &quot;GHC.Iface.Rename&quot;).  Specifically, a 'NameShape' for</span><span>
</span><span id="line-154"></span><span class="hs-comment">-- 'ns_module_name' @A@, defines a mapping from @{A.T}@</span><span>
</span><span id="line-155"></span><span class="hs-comment">-- (for some 'OccName' @T@) to some arbitrary other 'Name'.</span><span>
</span><span id="line-156"></span><span class="hs-comment">--</span><span>
</span><span id="line-157"></span><span class="hs-comment">-- The most intruiging thing about a 'NameShape', however, is</span><span>
</span><span id="line-158"></span><span class="hs-comment">-- how it's constructed.  A 'NameShape' is *implied* by the</span><span>
</span><span id="line-159"></span><span class="hs-comment">-- exported 'AvailInfo's of the implementor of an interface:</span><span>
</span><span id="line-160"></span><span class="hs-comment">-- if an implementor of signature @\&lt;H&gt;@ exports @M.T@, you implicitly</span><span>
</span><span id="line-161"></span><span class="hs-comment">-- define a substitution from @{H.T}@ to @M.T@.  So a 'NameShape'</span><span>
</span><span id="line-162"></span><span class="hs-comment">-- is computed from the list of 'AvailInfo's that are exported</span><span>
</span><span id="line-163"></span><span class="hs-comment">-- by the implementation of a module, or successively merged</span><span>
</span><span id="line-164"></span><span class="hs-comment">-- together by the export lists of signatures which are joining</span><span>
</span><span id="line-165"></span><span class="hs-comment">-- together.</span><span>
</span><span id="line-166"></span><span class="hs-comment">--</span><span>
</span><span id="line-167"></span><span class="hs-comment">-- It's not the most obvious way to go about doing this, but it</span><span>
</span><span id="line-168"></span><span class="hs-comment">-- does seem to work!</span><span>
</span><span id="line-169"></span><span class="hs-comment">--</span><span>
</span><span id="line-170"></span><span class="hs-comment">-- NB: Can't boot this and put it in NameShape because then we</span><span>
</span><span id="line-171"></span><span class="hs-comment">-- start pulling in too many DynFlags things.</span><span>
</span><span id="line-172"></span><span class="hs-keyword">data</span><span> </span><span id="NameShape"><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-var">NameShape</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="NameShape"><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-var">NameShape</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-173"></span><span>        </span><span id="ns_mod_name"><span class="annot"><span class="annottext">NameShape -&gt; ModuleName
</span><a href="GHC.Tc.Types.html#ns_mod_name"><span class="hs-identifier hs-var hs-var">ns_mod_name</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-174"></span><span>        </span><span id="ns_exports"><span class="annot"><span class="annottext">NameShape -&gt; [AvailInfo]
</span><a href="GHC.Tc.Types.html#ns_exports"><span class="hs-identifier hs-var hs-var">ns_exports</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-175"></span><span>        </span><span id="ns_map"><span class="annot"><span class="annottext">NameShape -&gt; OccEnv Name
</span><a href="GHC.Tc.Types.html#ns_map"><span class="hs-identifier hs-var hs-var">ns_map</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccEnv"><span class="hs-identifier hs-type">OccEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-176"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-177"></span><span>
</span><span id="line-178"></span><span>
</span><span id="line-179"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
               Standard monad definition for TcRn
    All the combinators for the monad can be found in GHC.Tc.Utils.Monad
*                                                                      *
************************************************************************

The monad itself has to be defined here, because it is mentioned by ErrCtxt
-}</span><span>
</span><span id="line-189"></span><span>
</span><span id="line-190"></span><span class="hs-keyword">type</span><span> </span><span id="TcRnIf"><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-var">TcRnIf</span></a></span></span><span> </span><span id="local-6989586621680879953"><span class="annot"><a href="#local-6989586621680879953"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621680879952"><span class="annot"><a href="#local-6989586621680879952"><span class="hs-identifier hs-type">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#Env"><span class="hs-identifier hs-type">Env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680879953"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680879952"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-191"></span><span class="hs-keyword">type</span><span> </span><span id="TcRn"><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-var">TcRn</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-type">TcRnIf</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span>    </span><span class="hs-comment">-- Type inference</span><span>
</span><span id="line-192"></span><span class="hs-keyword">type</span><span> </span><span id="IfM"><span class="annot"><a href="GHC.Tc.Types.html#IfM"><span class="hs-identifier hs-var">IfM</span></a></span></span><span> </span><span id="local-6989586621680879951"><span class="annot"><a href="#local-6989586621680879951"><span class="hs-identifier hs-type">lcl</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-type">TcRnIf</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IfGblEnv"><span class="hs-identifier hs-type">IfGblEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680879951"><span class="hs-identifier hs-type">lcl</span></a></span><span>         </span><span class="hs-comment">-- Iface stuff</span><span>
</span><span id="line-193"></span><span class="hs-keyword">type</span><span> </span><span id="IfG"><span class="annot"><a href="GHC.Tc.Types.html#IfG"><span class="hs-identifier hs-var">IfG</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IfM"><span class="hs-identifier hs-type">IfM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>                      </span><span class="hs-comment">--    Top level</span><span>
</span><span id="line-194"></span><span class="hs-keyword">type</span><span> </span><span id="IfL"><span class="annot"><a href="GHC.Tc.Types.html#IfL"><span class="hs-identifier hs-var">IfL</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IfM"><span class="hs-identifier hs-type">IfM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IfLclEnv"><span class="hs-identifier hs-type">IfLclEnv</span></a></span><span>                </span><span class="hs-comment">--    Nested</span><span>
</span><span id="line-195"></span><span class="hs-keyword">type</span><span> </span><span id="DsM"><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-var">DsM</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-type">TcRnIf</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsGblEnv"><span class="hs-identifier hs-type">DsGblEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsLclEnv"><span class="hs-identifier hs-type">DsLclEnv</span></a></span><span>    </span><span class="hs-comment">-- Desugaring</span><span>
</span><span id="line-196"></span><span>
</span><span id="line-197"></span><span class="hs-comment">-- TcRn is the type-checking and renaming monad: the main monad that</span><span>
</span><span id="line-198"></span><span class="hs-comment">-- most type-checking takes place in.  The global environment is</span><span>
</span><span id="line-199"></span><span class="hs-comment">-- 'TcGblEnv', which tracks all of the top-level type-checking</span><span>
</span><span id="line-200"></span><span class="hs-comment">-- information we've accumulated while checking a module, while the</span><span>
</span><span id="line-201"></span><span class="hs-comment">-- local environment is 'TcLclEnv', which tracks local information as</span><span>
</span><span id="line-202"></span><span class="hs-comment">-- we move inside expressions.</span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span class="hs-comment">-- | Historical &quot;renaming monad&quot; (now it's just 'TcRn').</span><span>
</span><span id="line-205"></span><span class="hs-keyword">type</span><span> </span><span id="RnM"><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-var">RnM</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span class="hs-comment">-- | Historical &quot;type-checking monad&quot; (now it's just 'TcRn').</span><span>
</span><span id="line-208"></span><span class="hs-keyword">type</span><span> </span><span id="TcM"><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-var">TcM</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span>
</span><span id="line-209"></span><span>
</span><span id="line-210"></span><span class="hs-comment">-- We 'stack' these envs through the Reader like monad infrastructure</span><span>
</span><span id="line-211"></span><span class="hs-comment">-- as we move into an expression (although the change is focused in</span><span>
</span><span id="line-212"></span><span class="hs-comment">-- the lcl type).</span><span>
</span><span id="line-213"></span><span class="hs-keyword">data</span><span> </span><span id="Env"><span class="annot"><a href="GHC.Tc.Types.html#Env"><span class="hs-identifier hs-var">Env</span></a></span></span><span> </span><span id="local-6989586621680880331"><span class="annot"><a href="#local-6989586621680880331"><span class="hs-identifier hs-type">gbl</span></a></span></span><span> </span><span id="local-6989586621680880330"><span class="annot"><a href="#local-6989586621680880330"><span class="hs-identifier hs-type">lcl</span></a></span></span><span>
</span><span id="line-214"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Env"><span class="annot"><a href="GHC.Tc.Types.html#Env"><span class="hs-identifier hs-var">Env</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-215"></span><span>        </span><span id="env_top"><span class="annot"><span class="annottext">forall gbl lcl. Env gbl lcl -&gt; HscEnv
</span><a href="GHC.Tc.Types.html#env_top"><span class="hs-identifier hs-var hs-var">env_top</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- Top-level stuff that never changes</span><span>
</span><span id="line-216"></span><span>                             </span><span class="hs-comment">-- Includes all info about imported things</span><span>
</span><span id="line-217"></span><span>                             </span><span class="hs-comment">-- BangPattern is to fix leak, see #15111</span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span>        </span><span id="env_um"><span class="annot"><span class="annottext">forall gbl lcl. Env gbl lcl -&gt; Char
</span><a href="GHC.Tc.Types.html#env_um"><span class="hs-identifier hs-var hs-var">env_um</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span class="hs-special">,</span><span>   </span><span class="hs-comment">-- Mask for Uniques</span><span>
</span><span id="line-220"></span><span>
</span><span id="line-221"></span><span>        </span><span id="env_gbl"><span class="annot"><span class="annottext">forall gbl lcl. Env gbl lcl -&gt; gbl
</span><a href="GHC.Tc.Types.html#env_gbl"><span class="hs-identifier hs-var hs-var">env_gbl</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680880331"><span class="hs-identifier hs-type">gbl</span></a></span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- Info about things defined at the top level</span><span>
</span><span id="line-222"></span><span>                             </span><span class="hs-comment">-- of the module being compiled</span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span>        </span><span id="env_lcl"><span class="annot"><span class="annottext">forall gbl lcl. Env gbl lcl -&gt; lcl
</span><a href="GHC.Tc.Types.html#env_lcl"><span class="hs-identifier hs-var hs-var">env_lcl</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680880330"><span class="hs-identifier hs-type">lcl</span></a></span><span>      </span><span class="hs-comment">-- Nested stuff; changes as we go into</span><span>
</span><span id="line-225"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-226"></span><span>
</span><span id="line-227"></span><span id="local-6989586621680880336"><span id="local-6989586621680880337"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#ContainsDynFlags"><span class="hs-identifier hs-type">ContainsDynFlags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#Env"><span class="hs-identifier hs-type">Env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680880337"><span class="hs-identifier hs-type">gbl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680880336"><span class="hs-identifier hs-type">lcl</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-228"></span><span>    </span><span id="local-6989586621680879943"><span class="annot"><span class="annottext">extractDynFlags :: Env gbl lcl -&gt; DynFlags
</span><a href="GHC.Driver.Session.html#extractDynFlags"><span class="hs-identifier hs-var hs-var hs-var hs-var">extractDynFlags</span></a></span></span><span> </span><span id="local-6989586621680879941"><span class="annot"><span class="annottext">Env gbl lcl
</span><a href="#local-6989586621680879941"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Env gbl lcl -&gt; HscEnv
forall gbl lcl. Env gbl lcl -&gt; HscEnv
</span><a href="GHC.Tc.Types.html#env_top"><span class="hs-identifier hs-var hs-var">env_top</span></a></span><span> </span><span class="annot"><span class="annottext">Env gbl lcl
</span><a href="#local-6989586621680879941"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span id="local-6989586621680880311"><span id="local-6989586621680880312"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html#ContainsModule"><span class="hs-identifier hs-type">ContainsModule</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680880312"><span class="hs-identifier hs-type">gbl</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html#ContainsModule"><span class="hs-identifier hs-type">ContainsModule</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#Env"><span class="hs-identifier hs-type">Env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680880312"><span class="hs-identifier hs-type">gbl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680880311"><span class="hs-identifier hs-type">lcl</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-231"></span><span>    </span><span id="local-6989586621680879934"><span class="annot"><span class="annottext">extractModule :: Env gbl lcl -&gt; Module
</span><a href="GHC.Unit.Module.html#extractModule"><span class="hs-identifier hs-var hs-var hs-var hs-var">extractModule</span></a></span></span><span> </span><span id="local-6989586621680879932"><span class="annot"><span class="annottext">Env gbl lcl
</span><a href="#local-6989586621680879932"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">gbl -&gt; Module
forall t. ContainsModule t =&gt; t -&gt; Module
</span><a href="GHC.Unit.Module.html#extractModule"><span class="hs-identifier hs-var">extractModule</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Env gbl lcl -&gt; gbl
forall gbl lcl. Env gbl lcl -&gt; gbl
</span><a href="GHC.Tc.Types.html#env_gbl"><span class="hs-identifier hs-var hs-var">env_gbl</span></a></span><span> </span><span class="annot"><span class="annottext">Env gbl lcl
</span><a href="#local-6989586621680879932"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-232"></span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                The interface environments
              Used when dealing with IfaceDecls
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-242"></span><span>
</span><span id="line-243"></span><span class="hs-keyword">data</span><span> </span><span id="IfGblEnv"><span class="annot"><a href="GHC.Tc.Types.html#IfGblEnv"><span class="hs-identifier hs-var">IfGblEnv</span></a></span></span><span>
</span><span id="line-244"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="IfGblEnv"><span class="annot"><a href="GHC.Tc.Types.html#IfGblEnv"><span class="hs-identifier hs-var">IfGblEnv</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-245"></span><span>        </span><span class="hs-comment">-- Some information about where this environment came from;</span><span>
</span><span id="line-246"></span><span>        </span><span class="hs-comment">-- useful for debugging.</span><span>
</span><span id="line-247"></span><span>        </span><span id="if_doc"><span class="annot"><span class="annottext">IfGblEnv -&gt; SDoc
</span><a href="GHC.Tc.Types.html#if_doc"><span class="hs-identifier hs-var hs-var">if_doc</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-248"></span><span>        </span><span class="hs-comment">-- The type environment for the module being compiled,</span><span>
</span><span id="line-249"></span><span>        </span><span class="hs-comment">-- in case the interface refers back to it via a reference that</span><span>
</span><span id="line-250"></span><span>        </span><span class="hs-comment">-- was originally a hi-boot file.</span><span>
</span><span id="line-251"></span><span>        </span><span class="hs-comment">-- We need the module name so we can test when it's appropriate</span><span>
</span><span id="line-252"></span><span>        </span><span class="hs-comment">-- to look in this env.</span><span>
</span><span id="line-253"></span><span>        </span><span class="hs-comment">-- See Note [Tying the knot] in GHC.IfaceToCore</span><span>
</span><span id="line-254"></span><span>        </span><span id="if_rec_types"><span class="annot"><span class="annottext">IfGblEnv -&gt; Maybe (Module, IfG TypeEnv)
</span><a href="GHC.Tc.Types.html#if_rec_types"><span class="hs-identifier hs-var hs-var">if_rec_types</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IfG"><span class="hs-identifier hs-type">IfG</span></a></span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#TypeEnv"><span class="hs-identifier hs-type">TypeEnv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-255"></span><span>                </span><span class="hs-comment">-- Allows a read effect, so it can be in a mutable</span><span>
</span><span id="line-256"></span><span>                </span><span class="hs-comment">-- variable; c.f. handling the external package type env</span><span>
</span><span id="line-257"></span><span>                </span><span class="hs-comment">-- Nothing =&gt; interactive stuff, no loops possible</span><span>
</span><span id="line-258"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-259"></span><span>
</span><span id="line-260"></span><span class="hs-keyword">data</span><span> </span><span id="IfLclEnv"><span class="annot"><a href="GHC.Tc.Types.html#IfLclEnv"><span class="hs-identifier hs-var">IfLclEnv</span></a></span></span><span>
</span><span id="line-261"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="IfLclEnv"><span class="annot"><a href="GHC.Tc.Types.html#IfLclEnv"><span class="hs-identifier hs-var">IfLclEnv</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-262"></span><span>        </span><span class="hs-comment">-- The module for the current IfaceDecl</span><span>
</span><span id="line-263"></span><span>        </span><span class="hs-comment">-- So if we see   f = \x -&gt; x</span><span>
</span><span id="line-264"></span><span>        </span><span class="hs-comment">-- it means M.f = \x -&gt; x, where M is the if_mod</span><span>
</span><span id="line-265"></span><span>        </span><span class="hs-comment">-- NB: This is a semantic module, see</span><span>
</span><span id="line-266"></span><span>        </span><span class="hs-comment">-- Note [Identity versus semantic module]</span><span>
</span><span id="line-267"></span><span>        </span><span id="if_mod"><span class="annot"><span class="annottext">IfLclEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#if_mod"><span class="hs-identifier hs-var hs-var">if_mod</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-268"></span><span>
</span><span id="line-269"></span><span>        </span><span class="hs-comment">-- Whether or not the IfaceDecl came from a boot</span><span>
</span><span id="line-270"></span><span>        </span><span class="hs-comment">-- file or not; we'll use this to choose between</span><span>
</span><span id="line-271"></span><span>        </span><span class="hs-comment">-- NoUnfolding and BootUnfolding</span><span>
</span><span id="line-272"></span><span>        </span><span id="if_boot"><span class="annot"><span class="annottext">IfLclEnv -&gt; IsBootInterface
</span><a href="GHC.Tc.Types.html#if_boot"><span class="hs-identifier hs-var hs-var">if_boot</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#IsBootInterface"><span class="hs-identifier hs-type">IsBootInterface</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span>        </span><span class="hs-comment">-- The field is used only for error reporting</span><span>
</span><span id="line-275"></span><span>        </span><span class="hs-comment">-- if (say) there's a Lint error in it</span><span>
</span><span id="line-276"></span><span>        </span><span id="if_loc"><span class="annot"><span class="annottext">IfLclEnv -&gt; SDoc
</span><a href="GHC.Tc.Types.html#if_loc"><span class="hs-identifier hs-var hs-var">if_loc</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-277"></span><span>                </span><span class="hs-comment">-- Where the interface came from:</span><span>
</span><span id="line-278"></span><span>                </span><span class="hs-comment">--      .hi file, or GHCi state, or ext core</span><span>
</span><span id="line-279"></span><span>                </span><span class="hs-comment">-- plus which bit is currently being examined</span><span>
</span><span id="line-280"></span><span>
</span><span id="line-281"></span><span>        </span><span id="if_nsubst"><span class="annot"><span class="annottext">IfLclEnv -&gt; Maybe NameShape
</span><a href="GHC.Tc.Types.html#if_nsubst"><span class="hs-identifier hs-var hs-var">if_nsubst</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-type">NameShape</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-282"></span><span>
</span><span id="line-283"></span><span>        </span><span class="hs-comment">-- This field is used to make sure &quot;implicit&quot; declarations</span><span>
</span><span id="line-284"></span><span>        </span><span class="hs-comment">-- (anything that cannot be exported in mi_exports) get</span><span>
</span><span id="line-285"></span><span>        </span><span class="hs-comment">-- wired up correctly in typecheckIfacesForMerging.  Most</span><span>
</span><span id="line-286"></span><span>        </span><span class="hs-comment">-- of the time it's @Nothing@.  See Note [Resolving never-exported Names]</span><span>
</span><span id="line-287"></span><span>        </span><span class="hs-comment">-- in GHC.IfaceToCore.</span><span>
</span><span id="line-288"></span><span>        </span><span id="if_implicits_env"><span class="annot"><span class="annottext">IfLclEnv -&gt; Maybe TypeEnv
</span><a href="GHC.Tc.Types.html#if_implicits_env"><span class="hs-identifier hs-var hs-var">if_implicits_env</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#TypeEnv"><span class="hs-identifier hs-type">TypeEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-289"></span><span>
</span><span id="line-290"></span><span>        </span><span id="if_tv_env"><span class="annot"><span class="annottext">IfLclEnv -&gt; FastStringEnv TyVar
</span><a href="GHC.Tc.Types.html#if_tv_env"><span class="hs-identifier hs-var hs-var">if_tv_env</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.FastString.Env.html#FastStringEnv"><span class="hs-identifier hs-type">FastStringEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- Nested tyvar bindings</span><span>
</span><span id="line-291"></span><span>        </span><span id="if_id_env"><span class="annot"><span class="annottext">IfLclEnv -&gt; FastStringEnv TyVar
</span><a href="GHC.Tc.Types.html#if_id_env"><span class="hs-identifier hs-var hs-var">if_id_env</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.FastString.Env.html#FastStringEnv"><span class="hs-identifier hs-type">FastStringEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>         </span><span class="hs-comment">-- Nested id binding</span><span>
</span><span id="line-292"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-293"></span><span>
</span><span id="line-294"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                Desugarer monad
*                                                                      *
************************************************************************

Now the mondo monad magic (yes, @DsM@ is a silly name)---carry around
a @UniqueSupply@ and some annotations, which
presumably include source-file location information:
-}</span><span>
</span><span id="line-305"></span><span>
</span><span id="line-306"></span><span class="hs-keyword">data</span><span> </span><span id="DsGblEnv"><span class="annot"><a href="GHC.Tc.Types.html#DsGblEnv"><span class="hs-identifier hs-var">DsGblEnv</span></a></span></span><span>
</span><span id="line-307"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span id="DsGblEnv"><span class="annot"><a href="GHC.Tc.Types.html#DsGblEnv"><span class="hs-identifier hs-var">DsGblEnv</span></a></span></span><span>
</span><span id="line-308"></span><span>        </span><span class="hs-special">{</span><span> </span><span id="ds_mod"><span class="annot"><span class="annottext">DsGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#ds_mod"><span class="hs-identifier hs-var hs-var">ds_mod</span></a></span></span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span>             </span><span class="hs-comment">-- For SCC profiling</span><span>
</span><span id="line-309"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ds_fam_inst_env"><span class="annot"><span class="annottext">DsGblEnv -&gt; FamInstEnv
</span><a href="GHC.Tc.Types.html#ds_fam_inst_env"><span class="hs-identifier hs-var hs-var">ds_fam_inst_env</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnv"><span class="hs-identifier hs-type">FamInstEnv</span></a></span><span>         </span><span class="hs-comment">-- Like tcg_fam_inst_env</span><span>
</span><span id="line-310"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ds_unqual"><span class="annot"><span class="annottext">DsGblEnv -&gt; PrintUnqualified
</span><a href="GHC.Tc.Types.html#ds_unqual"><span class="hs-identifier hs-var hs-var">ds_unqual</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#PrintUnqualified"><span class="hs-identifier hs-type">PrintUnqualified</span></a></span><span>
</span><span id="line-311"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ds_msgs"><span class="annot"><span class="annottext">DsGblEnv -&gt; IORef Messages
</span><a href="GHC.Tc.Types.html#ds_msgs"><span class="hs-identifier hs-var hs-var">ds_msgs</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span>          </span><span class="hs-comment">-- Warning messages</span><span>
</span><span id="line-312"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ds_if_env"><span class="annot"><span class="annottext">DsGblEnv -&gt; (IfGblEnv, IfLclEnv)
</span><a href="GHC.Tc.Types.html#ds_if_env"><span class="hs-identifier hs-var hs-var">ds_if_env</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#IfGblEnv"><span class="hs-identifier hs-type">IfGblEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IfLclEnv"><span class="hs-identifier hs-type">IfLclEnv</span></a></span><span class="hs-special">)</span><span>    </span><span class="hs-comment">-- Used for looking up global,</span><span>
</span><span id="line-313"></span><span>                                                </span><span class="hs-comment">-- possibly-imported things</span><span>
</span><span id="line-314"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ds_complete_matches"><span class="annot"><span class="annottext">DsGblEnv -&gt; CompleteMatchMap
</span><a href="GHC.Tc.Types.html#ds_complete_matches"><span class="hs-identifier hs-var hs-var">ds_complete_matches</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#CompleteMatchMap"><span class="hs-identifier hs-type">CompleteMatchMap</span></a></span><span>
</span><span id="line-315"></span><span>           </span><span class="hs-comment">-- Additional complete pattern matches</span><span>
</span><span id="line-316"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ds_cc_st"><span class="annot"><span class="annottext">DsGblEnv -&gt; IORef CostCentreState
</span><a href="GHC.Tc.Types.html#ds_cc_st"><span class="hs-identifier hs-var hs-var">ds_cc_st</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.State.html#CostCentreState"><span class="hs-identifier hs-type">CostCentreState</span></a></span><span>
</span><span id="line-317"></span><span>           </span><span class="hs-comment">-- Tracking indices for cost centre annotations</span><span>
</span><span id="line-318"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-319"></span><span>
</span><span id="line-320"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html#ContainsModule"><span class="hs-identifier hs-type">ContainsModule</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsGblEnv"><span class="hs-identifier hs-type">DsGblEnv</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-321"></span><span>    </span><span id="local-6989586621680879909"><span class="annot"><span class="annottext">extractModule :: DsGblEnv -&gt; Module
</span><a href="#local-6989586621680879909"><span class="hs-identifier hs-var hs-var hs-var hs-var">extractModule</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#ds_mod"><span class="hs-identifier hs-var hs-var">ds_mod</span></a></span><span>
</span><span id="line-322"></span><span>
</span><span id="line-323"></span><span class="hs-keyword">data</span><span> </span><span id="DsLclEnv"><span class="annot"><a href="GHC.Tc.Types.html#DsLclEnv"><span class="hs-identifier hs-var">DsLclEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="DsLclEnv"><span class="annot"><a href="GHC.Tc.Types.html#DsLclEnv"><span class="hs-identifier hs-var">DsLclEnv</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-324"></span><span>        </span><span id="dsl_meta"><span class="annot"><span class="annottext">DsLclEnv -&gt; DsMetaEnv
</span><a href="GHC.Tc.Types.html#dsl_meta"><span class="hs-identifier hs-var hs-var">dsl_meta</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsMetaEnv"><span class="hs-identifier hs-type">DsMetaEnv</span></a></span><span class="hs-special">,</span><span>        </span><span class="hs-comment">-- Template Haskell bindings</span><span>
</span><span id="line-325"></span><span>        </span><span id="dsl_loc"><span class="annot"><span class="annottext">DsLclEnv -&gt; RealSrcSpan
</span><a href="GHC.Tc.Types.html#dsl_loc"><span class="hs-identifier hs-var hs-var">dsl_loc</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcSpan"><span class="hs-identifier hs-type">RealSrcSpan</span></a></span><span class="hs-special">,</span><span>      </span><span class="hs-comment">-- To put in pattern-matching error msgs</span><span>
</span><span id="line-326"></span><span>
</span><span id="line-327"></span><span>        </span><span class="hs-comment">-- See Note [Note [Type and Term Equality Propagation] in &quot;GHC.HsToCore.PmCheck&quot;</span><span>
</span><span id="line-328"></span><span>        </span><span class="hs-comment">-- The set of reaching values Deltas is augmented as we walk inwards,</span><span>
</span><span id="line-329"></span><span>        </span><span class="hs-comment">-- refined through each pattern match in turn</span><span>
</span><span id="line-330"></span><span>        </span><span id="dsl_deltas"><span class="annot"><span class="annottext">DsLclEnv -&gt; Deltas
</span><a href="GHC.Tc.Types.html#dsl_deltas"><span class="hs-identifier hs-var hs-var">dsl_deltas</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span>
</span><span id="line-331"></span><span>     </span><span class="hs-special">}</span><span>
</span><span id="line-332"></span><span>
</span><span id="line-333"></span><span class="hs-comment">-- Inside [| |] brackets, the desugarer looks</span><span>
</span><span id="line-334"></span><span class="hs-comment">-- up variables in the DsMetaEnv</span><span>
</span><span id="line-335"></span><span class="hs-keyword">type</span><span> </span><span id="DsMetaEnv"><span class="annot"><a href="GHC.Tc.Types.html#DsMetaEnv"><span class="hs-identifier hs-var">DsMetaEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsMetaVal"><span class="hs-identifier hs-type">DsMetaVal</span></a></span><span>
</span><span id="line-336"></span><span>
</span><span id="line-337"></span><span class="hs-keyword">data</span><span> </span><span id="DsMetaVal"><span class="annot"><a href="GHC.Tc.Types.html#DsMetaVal"><span class="hs-identifier hs-var">DsMetaVal</span></a></span></span><span>
</span><span id="line-338"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="DsBound"><span class="annot"><a href="GHC.Tc.Types.html#DsBound"><span class="hs-identifier hs-var">DsBound</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>         </span><span class="hs-comment">-- Bound by a pattern inside the [| |].</span><span>
</span><span id="line-339"></span><span>                        </span><span class="hs-comment">-- Will be dynamically alpha renamed.</span><span>
</span><span id="line-340"></span><span>                        </span><span class="hs-comment">-- The Id has type THSyntax.Var</span><span>
</span><span id="line-341"></span><span>
</span><span id="line-342"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="DsSplice"><span class="annot"><a href="GHC.Tc.Types.html#DsSplice"><span class="hs-identifier hs-var">DsSplice</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#HsExpr"><span class="hs-identifier hs-type">HsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- These bindings are introduced by</span><span>
</span><span id="line-343"></span><span>                             </span><span class="hs-comment">-- the PendingSplices on a HsBracketOut</span><span>
</span><span id="line-344"></span><span>
</span><span id="line-345"></span><span>
</span><span id="line-346"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                Global typechecker environment
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-353"></span><span>
</span><span id="line-354"></span><span class="hs-comment">-- | 'FrontendResult' describes the result of running the frontend of a Haskell</span><span>
</span><span id="line-355"></span><span class="hs-comment">-- module. Currently one always gets a 'FrontendTypecheck', since running the</span><span>
</span><span id="line-356"></span><span class="hs-comment">-- frontend involves typechecking a program. hs-sig merges are not handled here.</span><span>
</span><span id="line-357"></span><span class="hs-comment">--</span><span>
</span><span id="line-358"></span><span class="hs-comment">-- This data type really should be in GHC.Driver.Types, but it needs</span><span>
</span><span id="line-359"></span><span class="hs-comment">-- to have a TcGblEnv which is only defined here.</span><span>
</span><span id="line-360"></span><span class="hs-keyword">data</span><span> </span><span id="FrontendResult"><span class="annot"><a href="GHC.Tc.Types.html#FrontendResult"><span class="hs-identifier hs-var">FrontendResult</span></a></span></span><span>
</span><span id="line-361"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span id="FrontendTypecheck"><span class="annot"><a href="GHC.Tc.Types.html#FrontendTypecheck"><span class="hs-identifier hs-var">FrontendTypecheck</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span class="hs-comment">-- Note [Identity versus semantic module]</span><span>
</span><span id="line-364"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-365"></span><span class="hs-comment">-- When typechecking an hsig file, it is convenient to keep track</span><span>
</span><span id="line-366"></span><span class="hs-comment">-- of two different &quot;this module&quot; identifiers:</span><span>
</span><span id="line-367"></span><span class="hs-comment">--</span><span>
</span><span id="line-368"></span><span class="hs-comment">--      - The IDENTITY module is simply thisPackage + the module</span><span>
</span><span id="line-369"></span><span class="hs-comment">--        name; i.e. it uniquely *identifies* the interface file</span><span>
</span><span id="line-370"></span><span class="hs-comment">--        we're compiling.  For example, p[A=&lt;A&gt;]:A is an</span><span>
</span><span id="line-371"></span><span class="hs-comment">--        identity module identifying the requirement named A</span><span>
</span><span id="line-372"></span><span class="hs-comment">--        from library p.</span><span>
</span><span id="line-373"></span><span class="hs-comment">--</span><span>
</span><span id="line-374"></span><span class="hs-comment">--      - The SEMANTIC module, which is the actual module that</span><span>
</span><span id="line-375"></span><span class="hs-comment">--        this signature is intended to represent (e.g. if</span><span>
</span><span id="line-376"></span><span class="hs-comment">--        we have a identity module p[A=base:Data.IORef]:A,</span><span>
</span><span id="line-377"></span><span class="hs-comment">--        then the semantic module is base:Data.IORef)</span><span>
</span><span id="line-378"></span><span class="hs-comment">--</span><span>
</span><span id="line-379"></span><span class="hs-comment">-- Which one should you use?</span><span>
</span><span id="line-380"></span><span class="hs-comment">--</span><span>
</span><span id="line-381"></span><span class="hs-comment">--      - In the desugarer and later phases of compilation,</span><span>
</span><span id="line-382"></span><span class="hs-comment">--        identity and semantic modules coincide, since we never compile</span><span>
</span><span id="line-383"></span><span class="hs-comment">--        signatures (we just generate blank object files for</span><span>
</span><span id="line-384"></span><span class="hs-comment">--        hsig files.)</span><span>
</span><span id="line-385"></span><span class="hs-comment">--</span><span>
</span><span id="line-386"></span><span class="hs-comment">--        A corrolary of this is that the following invariant holds at any point</span><span>
</span><span id="line-387"></span><span class="hs-comment">--        past desugaring,</span><span>
</span><span id="line-388"></span><span class="hs-comment">--</span><span>
</span><span id="line-389"></span><span class="hs-comment">--            if I have a Module, this_mod, in hand representing the module</span><span>
</span><span id="line-390"></span><span class="hs-comment">--            currently being compiled,</span><span>
</span><span id="line-391"></span><span class="hs-comment">--            then moduleUnit this_mod == thisPackage dflags</span><span>
</span><span id="line-392"></span><span class="hs-comment">--</span><span>
</span><span id="line-393"></span><span class="hs-comment">--      - For any code involving Names, we want semantic modules.</span><span>
</span><span id="line-394"></span><span class="hs-comment">--        See lookupIfaceTop in GHC.Iface.Env, mkIface and addFingerprints</span><span>
</span><span id="line-395"></span><span class="hs-comment">--        in GHC.Iface.{Make,Recomp}, and tcLookupGlobal in GHC.Tc.Utils.Env</span><span>
</span><span id="line-396"></span><span class="hs-comment">--</span><span>
</span><span id="line-397"></span><span class="hs-comment">--      - When reading interfaces, we want the identity module to</span><span>
</span><span id="line-398"></span><span class="hs-comment">--        identify the specific interface we want (such interfaces</span><span>
</span><span id="line-399"></span><span class="hs-comment">--        should never be loaded into the EPS).  However, if a</span><span>
</span><span id="line-400"></span><span class="hs-comment">--        hole module &lt;A&gt; is requested, we look for A.hi</span><span>
</span><span id="line-401"></span><span class="hs-comment">--        in the home library we are compiling.  (See GHC.Iface.Load.)</span><span>
</span><span id="line-402"></span><span class="hs-comment">--        Similarly, in GHC.Rename.Names we check for self-imports using</span><span>
</span><span id="line-403"></span><span class="hs-comment">--        identity modules, to allow signatures to import their implementor.</span><span>
</span><span id="line-404"></span><span class="hs-comment">--</span><span>
</span><span id="line-405"></span><span class="hs-comment">--      - For recompilation avoidance, you want the identity module,</span><span>
</span><span id="line-406"></span><span class="hs-comment">--        since that will actually say the specific interface you</span><span>
</span><span id="line-407"></span><span class="hs-comment">--        want to track (and recompile if it changes)</span><span>
</span><span id="line-408"></span><span>
</span><span id="line-409"></span><span class="hs-comment">-- | 'TcGblEnv' describes the top-level of the module at the</span><span>
</span><span id="line-410"></span><span class="hs-comment">-- point at which the typechecker is finished work.</span><span>
</span><span id="line-411"></span><span class="hs-comment">-- It is this structure that is handed on to the desugarer</span><span>
</span><span id="line-412"></span><span class="hs-comment">-- For state that needs to be updated during the typechecking</span><span>
</span><span id="line-413"></span><span class="hs-comment">-- phase and returned at end, use a 'TcRef' (= 'IORef').</span><span>
</span><span id="line-414"></span><span class="hs-keyword">data</span><span> </span><span id="TcGblEnv"><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-var">TcGblEnv</span></a></span></span><span>
</span><span id="line-415"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="TcGblEnv"><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-var">TcGblEnv</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-416"></span><span>        </span><span id="tcg_mod"><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_mod"><span class="hs-identifier hs-var hs-var">tcg_mod</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">,</span><span>         </span><span class="hs-comment">-- ^ Module being compiled</span><span>
</span><span id="line-417"></span><span>        </span><span id="tcg_semantic_mod"><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_semantic_mod"><span class="hs-identifier hs-var hs-var">tcg_semantic_mod</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">,</span><span>    </span><span class="hs-comment">-- ^ If a signature, the backing module</span><span>
</span><span id="line-418"></span><span>            </span><span class="hs-comment">-- See also Note [Identity versus semantic module]</span><span>
</span><span id="line-419"></span><span>        </span><span id="tcg_src"><span class="annot"><span class="annottext">TcGblEnv -&gt; HscSource
</span><a href="GHC.Tc.Types.html#tcg_src"><span class="hs-identifier hs-var hs-var">tcg_src</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Phases.html#HscSource"><span class="hs-identifier hs-type">HscSource</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-420"></span><span>          </span><span class="hs-comment">-- ^ What kind of module (regular Haskell, hs-boot, hsig)</span><span>
</span><span id="line-421"></span><span>
</span><span id="line-422"></span><span>        </span><span id="tcg_rdr_env"><span class="annot"><span class="annottext">TcGblEnv -&gt; GlobalRdrEnv
</span><a href="GHC.Tc.Types.html#tcg_rdr_env"><span class="hs-identifier hs-var hs-var">tcg_rdr_env</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrEnv"><span class="hs-identifier hs-type">GlobalRdrEnv</span></a></span><span class="hs-special">,</span><span>   </span><span class="hs-comment">-- ^ Top level envt; used during renaming</span><span>
</span><span id="line-423"></span><span>        </span><span id="tcg_default"><span class="annot"><span class="annottext">TcGblEnv -&gt; Maybe [Type]
</span><a href="GHC.Tc.Types.html#tcg_default"><span class="hs-identifier hs-var hs-var">tcg_default</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-424"></span><span>          </span><span class="hs-comment">-- ^ Types used for defaulting. @Nothing@ =&gt; no @default@ decl</span><span>
</span><span id="line-425"></span><span>
</span><span id="line-426"></span><span>        </span><span id="tcg_fix_env"><span class="annot"><span class="annottext">TcGblEnv -&gt; FixityEnv
</span><a href="GHC.Tc.Types.html#tcg_fix_env"><span class="hs-identifier hs-var hs-var">tcg_fix_env</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#FixityEnv"><span class="hs-identifier hs-type">FixityEnv</span></a></span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- ^ Just for things in this module</span><span>
</span><span id="line-427"></span><span>        </span><span id="tcg_field_env"><span class="annot"><span class="annottext">TcGblEnv -&gt; RecFieldEnv
</span><a href="GHC.Tc.Types.html#tcg_field_env"><span class="hs-identifier hs-var hs-var">tcg_field_env</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RecFieldEnv"><span class="hs-identifier hs-type">RecFieldEnv</span></a></span><span class="hs-special">,</span><span>   </span><span class="hs-comment">-- ^ Just for things in this module</span><span>
</span><span id="line-428"></span><span>                                        </span><span class="hs-comment">-- See Note [The interactive package] in &quot;GHC.Driver.Types&quot;</span><span>
</span><span id="line-429"></span><span>
</span><span id="line-430"></span><span>        </span><span id="tcg_type_env"><span class="annot"><span class="annottext">TcGblEnv -&gt; TypeEnv
</span><a href="GHC.Tc.Types.html#tcg_type_env"><span class="hs-identifier hs-var hs-var">tcg_type_env</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#TypeEnv"><span class="hs-identifier hs-type">TypeEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-431"></span><span>          </span><span class="hs-comment">-- ^ Global type env for the module we are compiling now.  All</span><span>
</span><span id="line-432"></span><span>          </span><span class="hs-comment">-- TyCons and Classes (for this module) end up in here right away,</span><span>
</span><span id="line-433"></span><span>          </span><span class="hs-comment">-- along with their derived constructors, selectors.</span><span>
</span><span id="line-434"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-435"></span><span>          </span><span class="hs-comment">-- (Ids defined in this module start in the local envt, though they</span><span>
</span><span id="line-436"></span><span>          </span><span class="hs-comment">--  move to the global envt during zonking)</span><span>
</span><span id="line-437"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-438"></span><span>          </span><span class="hs-comment">-- NB: for what &quot;things in this module&quot; means, see</span><span>
</span><span id="line-439"></span><span>          </span><span class="hs-comment">-- Note [The interactive package] in &quot;GHC.Driver.Types&quot;</span><span>
</span><span id="line-440"></span><span>
</span><span id="line-441"></span><span>        </span><span id="tcg_type_env_var"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef TypeEnv
</span><a href="GHC.Tc.Types.html#tcg_type_env_var"><span class="hs-identifier hs-var hs-var">tcg_type_env_var</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#TypeEnv"><span class="hs-identifier hs-type">TypeEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-442"></span><span>                </span><span class="hs-comment">-- Used only to initialise the interface-file</span><span>
</span><span id="line-443"></span><span>                </span><span class="hs-comment">-- typechecker in initIfaceTcRn, so that it can see stuff</span><span>
</span><span id="line-444"></span><span>                </span><span class="hs-comment">-- bound in this module when dealing with hi-boot recursions</span><span>
</span><span id="line-445"></span><span>                </span><span class="hs-comment">-- Updated at intervals (e.g. after dealing with types and classes)</span><span>
</span><span id="line-446"></span><span>
</span><span id="line-447"></span><span>        </span><span id="tcg_inst_env"><span class="annot"><span class="annottext">TcGblEnv -&gt; InstEnv
</span><a href="GHC.Tc.Types.html#tcg_inst_env"><span class="hs-identifier hs-var hs-var">tcg_inst_env</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Core.InstEnv.html#InstEnv"><span class="hs-identifier hs-type">InstEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-448"></span><span>          </span><span class="hs-comment">-- ^ Instance envt for all /home-package/ modules;</span><span>
</span><span id="line-449"></span><span>          </span><span class="hs-comment">-- Includes the dfuns in tcg_insts</span><span>
</span><span id="line-450"></span><span>          </span><span class="hs-comment">-- NB. BangPattern is to fix a leak, see #15111</span><span>
</span><span id="line-451"></span><span>        </span><span id="tcg_fam_inst_env"><span class="annot"><span class="annottext">TcGblEnv -&gt; FamInstEnv
</span><a href="GHC.Tc.Types.html#tcg_fam_inst_env"><span class="hs-identifier hs-var hs-var">tcg_fam_inst_env</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnv"><span class="hs-identifier hs-type">FamInstEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- ^ Ditto for family instances</span><span>
</span><span id="line-452"></span><span>          </span><span class="hs-comment">-- NB. BangPattern is to fix a leak, see #15111</span><span>
</span><span id="line-453"></span><span>        </span><span id="tcg_ann_env"><span class="annot"><span class="annottext">TcGblEnv -&gt; AnnEnv
</span><a href="GHC.Tc.Types.html#tcg_ann_env"><span class="hs-identifier hs-var hs-var">tcg_ann_env</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Annotations.html#AnnEnv"><span class="hs-identifier hs-type">AnnEnv</span></a></span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- ^ And for annotations</span><span>
</span><span id="line-454"></span><span>
</span><span id="line-455"></span><span>                </span><span class="hs-comment">-- Now a bunch of things about this module that are simply</span><span>
</span><span id="line-456"></span><span>                </span><span class="hs-comment">-- accumulated, but never consulted until the end.</span><span>
</span><span id="line-457"></span><span>                </span><span class="hs-comment">-- Nevertheless, it's convenient to accumulate them along</span><span>
</span><span id="line-458"></span><span>                </span><span class="hs-comment">-- with the rest of the info from this module.</span><span>
</span><span id="line-459"></span><span>        </span><span id="tcg_exports"><span class="annot"><span class="annottext">TcGblEnv -&gt; [AvailInfo]
</span><a href="GHC.Tc.Types.html#tcg_exports"><span class="hs-identifier hs-var hs-var">tcg_exports</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- ^ What is exported</span><span>
</span><span id="line-460"></span><span>        </span><span id="tcg_imports"><span class="annot"><span class="annottext">TcGblEnv -&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#tcg_imports"><span class="hs-identifier hs-var hs-var">tcg_imports</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-461"></span><span>          </span><span class="hs-comment">-- ^ Information about what was imported from where, including</span><span>
</span><span id="line-462"></span><span>          </span><span class="hs-comment">-- things bound in this module. Also store Safe Haskell info</span><span>
</span><span id="line-463"></span><span>          </span><span class="hs-comment">-- here about transitive trusted package requirements.</span><span>
</span><span id="line-464"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-465"></span><span>          </span><span class="hs-comment">-- There are not many uses of this field, so you can grep for</span><span>
</span><span id="line-466"></span><span>          </span><span class="hs-comment">-- all them.</span><span>
</span><span id="line-467"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-468"></span><span>          </span><span class="hs-comment">-- The ImportAvails records information about the following</span><span>
</span><span id="line-469"></span><span>          </span><span class="hs-comment">-- things:</span><span>
</span><span id="line-470"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-471"></span><span>          </span><span class="hs-comment">--    1. All of the modules you directly imported (tcRnImports)</span><span>
</span><span id="line-472"></span><span>          </span><span class="hs-comment">--    2. The orphans (only!) of all imported modules in a GHCi</span><span>
</span><span id="line-473"></span><span>          </span><span class="hs-comment">--       session (runTcInteractive)</span><span>
</span><span id="line-474"></span><span>          </span><span class="hs-comment">--    3. The module that instantiated a signature</span><span>
</span><span id="line-475"></span><span>          </span><span class="hs-comment">--    4. Each of the signatures that merged in</span><span>
</span><span id="line-476"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-477"></span><span>          </span><span class="hs-comment">-- It is used in the following ways:</span><span>
</span><span id="line-478"></span><span>          </span><span class="hs-comment">--    - imp_orphs is used to determine what orphan modules should be</span><span>
</span><span id="line-479"></span><span>          </span><span class="hs-comment">--      visible in the context (tcVisibleOrphanMods)</span><span>
</span><span id="line-480"></span><span>          </span><span class="hs-comment">--    - imp_finsts is used to determine what family instances should</span><span>
</span><span id="line-481"></span><span>          </span><span class="hs-comment">--      be visible (tcExtendLocalFamInstEnv)</span><span>
</span><span id="line-482"></span><span>          </span><span class="hs-comment">--    - To resolve the meaning of the export list of a module</span><span>
</span><span id="line-483"></span><span>          </span><span class="hs-comment">--      (tcRnExports)</span><span>
</span><span id="line-484"></span><span>          </span><span class="hs-comment">--    - imp_mods is used to compute usage info (mkIfaceTc, deSugar)</span><span>
</span><span id="line-485"></span><span>          </span><span class="hs-comment">--    - imp_trust_own_pkg is used for Safe Haskell in interfaces</span><span>
</span><span id="line-486"></span><span>          </span><span class="hs-comment">--      (mkIfaceTc, as well as in &quot;GHC.Driver.Main&quot;)</span><span>
</span><span id="line-487"></span><span>          </span><span class="hs-comment">--    - To create the Dependencies field in interface (mkDependencies)</span><span>
</span><span id="line-488"></span><span>
</span><span id="line-489"></span><span>          </span><span class="hs-comment">-- These three fields track unused bindings and imports</span><span>
</span><span id="line-490"></span><span>          </span><span class="hs-comment">-- See Note [Tracking unused binding and imports]</span><span>
</span><span id="line-491"></span><span>        </span><span id="tcg_dus"><span class="annot"><span class="annottext">TcGblEnv -&gt; DefUses
</span><a href="GHC.Tc.Types.html#tcg_dus"><span class="hs-identifier hs-var hs-var">tcg_dus</span></a></span></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#DefUses"><span class="hs-identifier hs-type">DefUses</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-492"></span><span>        </span><span id="tcg_used_gres"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef [GlobalRdrElt]
</span><a href="GHC.Tc.Types.html#tcg_used_gres"><span class="hs-identifier hs-var hs-var">tcg_used_gres</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-493"></span><span>        </span><span id="tcg_keep"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef NameSet
</span><a href="GHC.Tc.Types.html#tcg_keep"><span class="hs-identifier hs-var hs-var">tcg_keep</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-494"></span><span>
</span><span id="line-495"></span><span>        </span><span id="tcg_th_used"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef Bool
</span><a href="GHC.Tc.Types.html#tcg_th_used"><span class="hs-identifier hs-var hs-var">tcg_th_used</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span>
</span><span id="line-496"></span><span>          </span><span class="hs-comment">-- ^ @True@ \&lt;=&gt; Template Haskell syntax used.</span><span>
</span><span id="line-497"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-498"></span><span>          </span><span class="hs-comment">-- We need this so that we can generate a dependency on the</span><span>
</span><span id="line-499"></span><span>          </span><span class="hs-comment">-- Template Haskell package, because the desugarer is going</span><span>
</span><span id="line-500"></span><span>          </span><span class="hs-comment">-- to emit loads of references to TH symbols.  The reference</span><span>
</span><span id="line-501"></span><span>          </span><span class="hs-comment">-- is implicit rather than explicit, so we have to zap a</span><span>
</span><span id="line-502"></span><span>          </span><span class="hs-comment">-- mutable variable.</span><span>
</span><span id="line-503"></span><span>
</span><span id="line-504"></span><span>        </span><span id="tcg_th_splice_used"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef Bool
</span><a href="GHC.Tc.Types.html#tcg_th_splice_used"><span class="hs-identifier hs-var hs-var">tcg_th_splice_used</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span>
</span><span id="line-505"></span><span>          </span><span class="hs-comment">-- ^ @True@ \&lt;=&gt; A Template Haskell splice was used.</span><span>
</span><span id="line-506"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-507"></span><span>          </span><span class="hs-comment">-- Splices disable recompilation avoidance (see #481)</span><span>
</span><span id="line-508"></span><span>
</span><span id="line-509"></span><span>        </span><span id="tcg_dfun_n"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef OccSet
</span><a href="GHC.Tc.Types.html#tcg_dfun_n"><span class="hs-identifier hs-var hs-var">tcg_dfun_n</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccSet"><span class="hs-identifier hs-type">OccSet</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-510"></span><span>          </span><span class="hs-comment">-- ^ Allows us to choose unique DFun names.</span><span>
</span><span id="line-511"></span><span>
</span><span id="line-512"></span><span>        </span><span id="tcg_merged"><span class="annot"><span class="annottext">TcGblEnv -&gt; [(Module, Fingerprint)]
</span><a href="GHC.Tc.Types.html#tcg_merged"><span class="hs-identifier hs-var hs-var">tcg_merged</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Fingerprint.Type.html#Fingerprint"><span class="hs-identifier hs-type">Fingerprint</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-513"></span><span>          </span><span class="hs-comment">-- ^ The requirements we merged with; we always have to recompile</span><span>
</span><span id="line-514"></span><span>          </span><span class="hs-comment">-- if any of these changed.</span><span>
</span><span id="line-515"></span><span>
</span><span id="line-516"></span><span>        </span><span class="hs-comment">-- The next fields accumulate the payload of the module</span><span>
</span><span id="line-517"></span><span>        </span><span class="hs-comment">-- The binds, rules and foreign-decl fields are collected</span><span>
</span><span id="line-518"></span><span>        </span><span class="hs-comment">-- initially in un-zonked form and are finally zonked in tcRnSrcDecls</span><span>
</span><span id="line-519"></span><span>
</span><span id="line-520"></span><span>        </span><span id="tcg_rn_exports"><span class="annot"><span class="annottext">TcGblEnv -&gt; Maybe [(Located (IE GhcRn), [AvailInfo])]
</span><a href="GHC.Tc.Types.html#tcg_rn_exports"><span class="hs-identifier hs-var hs-var">tcg_rn_exports</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#Avails"><span class="hs-identifier hs-type">Avails</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-521"></span><span>                </span><span class="hs-comment">-- Nothing &lt;=&gt; no explicit export list</span><span>
</span><span id="line-522"></span><span>                </span><span class="hs-comment">-- Is always Nothing if we don't want to retain renamed</span><span>
</span><span id="line-523"></span><span>                </span><span class="hs-comment">-- exports.</span><span>
</span><span id="line-524"></span><span>                </span><span class="hs-comment">-- If present contains each renamed export list item</span><span>
</span><span id="line-525"></span><span>                </span><span class="hs-comment">-- together with its exported names.</span><span>
</span><span id="line-526"></span><span>
</span><span id="line-527"></span><span>        </span><span id="tcg_rn_imports"><span class="annot"><span class="annottext">TcGblEnv -&gt; [LImportDecl GhcRn]
</span><a href="GHC.Tc.Types.html#tcg_rn_imports"><span class="hs-identifier hs-var hs-var">tcg_rn_imports</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-528"></span><span>                </span><span class="hs-comment">-- Keep the renamed imports regardless.  They are not</span><span>
</span><span id="line-529"></span><span>                </span><span class="hs-comment">-- voluminous and are needed if you want to report unused imports</span><span>
</span><span id="line-530"></span><span>
</span><span id="line-531"></span><span>        </span><span id="tcg_rn_decls"><span class="annot"><span class="annottext">TcGblEnv -&gt; Maybe (HsGroup GhcRn)
</span><a href="GHC.Tc.Types.html#tcg_rn_decls"><span class="hs-identifier hs-var hs-var">tcg_rn_decls</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#HsGroup"><span class="hs-identifier hs-type">HsGroup</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-532"></span><span>          </span><span class="hs-comment">-- ^ Renamed decls, maybe.  @Nothing@ \&lt;=&gt; Don't retain renamed</span><span>
</span><span id="line-533"></span><span>          </span><span class="hs-comment">-- decls.</span><span>
</span><span id="line-534"></span><span>
</span><span id="line-535"></span><span>        </span><span id="tcg_dependent_files"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef [FilePath]
</span><a href="GHC.Tc.Types.html#tcg_dependent_files"><span class="hs-identifier hs-var hs-var">tcg_dependent_files</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- ^ dependencies from addDependentFile</span><span>
</span><span id="line-536"></span><span>
</span><span id="line-537"></span><span>        </span><span id="tcg_th_topdecls"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef [LHsDecl GhcPs]
</span><a href="GHC.Tc.Types.html#tcg_th_topdecls"><span class="hs-identifier hs-var hs-var">tcg_th_topdecls</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LHsDecl"><span class="hs-identifier hs-type">LHsDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-538"></span><span>        </span><span class="hs-comment">-- ^ Top-level declarations from addTopDecls</span><span>
</span><span id="line-539"></span><span>
</span><span id="line-540"></span><span>        </span><span id="tcg_th_foreign_files"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef [(ForeignSrcLang, FilePath)]
</span><a href="GHC.Tc.Types.html#tcg_th_foreign_files"><span class="hs-identifier hs-var hs-var">tcg_th_foreign_files</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-boot-th/src/GHC.ForeignSrcLang.Type.html#ForeignSrcLang"><span class="hs-identifier hs-type">ForeignSrcLang</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-541"></span><span>        </span><span class="hs-comment">-- ^ Foreign files emitted from TH.</span><span>
</span><span id="line-542"></span><span>
</span><span id="line-543"></span><span>        </span><span id="tcg_th_topnames"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef NameSet
</span><a href="GHC.Tc.Types.html#tcg_th_topnames"><span class="hs-identifier hs-var hs-var">tcg_th_topnames</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-544"></span><span>        </span><span class="hs-comment">-- ^ Exact names bound in top-level declarations in tcg_th_topdecls</span><span>
</span><span id="line-545"></span><span>
</span><span id="line-546"></span><span>        </span><span id="tcg_th_modfinalizers"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef [(TcLclEnv, ThModFinalizers)]
</span><a href="GHC.Tc.Types.html#tcg_th_modfinalizers"><span class="hs-identifier hs-var hs-var">tcg_th_modfinalizers</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#ThModFinalizers"><span class="hs-identifier hs-type">ThModFinalizers</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-547"></span><span>        </span><span class="hs-comment">-- ^ Template Haskell module finalizers.</span><span>
</span><span id="line-548"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-549"></span><span>        </span><span class="hs-comment">-- They can use particular local environments.</span><span>
</span><span id="line-550"></span><span>
</span><span id="line-551"></span><span>        </span><span id="tcg_th_coreplugins"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef [FilePath]
</span><a href="GHC.Tc.Types.html#tcg_th_coreplugins"><span class="hs-identifier hs-var hs-var">tcg_th_coreplugins</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-552"></span><span>        </span><span class="hs-comment">-- ^ Core plugins added by Template Haskell code.</span><span>
</span><span id="line-553"></span><span>
</span><span id="line-554"></span><span>        </span><span id="tcg_th_state"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef (Map TypeRep Dynamic)
</span><a href="GHC.Tc.Types.html#tcg_th_state"><span class="hs-identifier hs-var hs-var">tcg_th_state</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../containers/src/Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="../../base/src/Data.Typeable.html#TypeRep"><span class="hs-identifier hs-type">TypeRep</span></a></span><span> </span><span class="annot"><a href="../../base/src/Data.Dynamic.html#Dynamic"><span class="hs-identifier hs-type">Dynamic</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-555"></span><span>        </span><span id="tcg_th_remote_state"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef (Maybe (ForeignRef (IORef QState)))
</span><a href="GHC.Tc.Types.html#tcg_th_remote_state"><span class="hs-identifier hs-var hs-var">tcg_th_remote_state</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-type">ForeignRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.Message.html#QState"><span class="hs-identifier hs-type">QState</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-556"></span><span>        </span><span class="hs-comment">-- ^ Template Haskell state</span><span>
</span><span id="line-557"></span><span>
</span><span id="line-558"></span><span>        </span><span id="tcg_ev_binds"><span class="annot"><span class="annottext">TcGblEnv -&gt; Bag EvBind
</span><a href="GHC.Tc.Types.html#tcg_ev_binds"><span class="hs-identifier hs-var hs-var">tcg_ev_binds</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#EvBind"><span class="hs-identifier hs-type">EvBind</span></a></span><span class="hs-special">,</span><span>        </span><span class="hs-comment">-- Top-level evidence bindings</span><span>
</span><span id="line-559"></span><span>
</span><span id="line-560"></span><span>        </span><span class="hs-comment">-- Things defined in this module, or (in GHCi)</span><span>
</span><span id="line-561"></span><span>        </span><span class="hs-comment">-- in the declarations for a single GHCi command.</span><span>
</span><span id="line-562"></span><span>        </span><span class="hs-comment">-- For the latter, see Note [The interactive package] in GHC.Driver.Types</span><span>
</span><span id="line-563"></span><span>        </span><span id="tcg_tr_module"><span class="annot"><span class="annottext">TcGblEnv -&gt; Maybe TyVar
</span><a href="GHC.Tc.Types.html#tcg_tr_module"><span class="hs-identifier hs-var hs-var">tcg_tr_module</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span>   </span><span class="hs-comment">-- Id for $trModule :: GHC.Unit.Module</span><span>
</span><span id="line-564"></span><span>                                             </span><span class="hs-comment">-- for which every module has a top-level defn</span><span>
</span><span id="line-565"></span><span>                                             </span><span class="hs-comment">-- except in GHCi in which case we have Nothing</span><span>
</span><span id="line-566"></span><span>        </span><span id="tcg_binds"><span class="annot"><span class="annottext">TcGblEnv -&gt; LHsBinds GhcTc
</span><a href="GHC.Tc.Types.html#tcg_binds"><span class="hs-identifier hs-var hs-var">tcg_binds</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- Value bindings in this module</span><span>
</span><span id="line-567"></span><span>        </span><span id="tcg_sigs"><span class="annot"><span class="annottext">TcGblEnv -&gt; NameSet
</span><a href="GHC.Tc.Types.html#tcg_sigs"><span class="hs-identifier hs-var hs-var">tcg_sigs</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- ...Top-level names that *lack* a signature</span><span>
</span><span id="line-568"></span><span>        </span><span id="tcg_imp_specs"><span class="annot"><span class="annottext">TcGblEnv -&gt; [LTcSpecPrag]
</span><a href="GHC.Tc.Types.html#tcg_imp_specs"><span class="hs-identifier hs-var hs-var">tcg_imp_specs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LTcSpecPrag"><span class="hs-identifier hs-type">LTcSpecPrag</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>      </span><span class="hs-comment">-- ...SPECIALISE prags for imported Ids</span><span>
</span><span id="line-569"></span><span>        </span><span id="tcg_warns"><span class="annot"><span class="annottext">TcGblEnv -&gt; Warnings
</span><a href="GHC.Tc.Types.html#tcg_warns"><span class="hs-identifier hs-var hs-var">tcg_warns</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#Warnings"><span class="hs-identifier hs-type">Warnings</span></a></span><span class="hs-special">,</span><span>           </span><span class="hs-comment">-- ...Warnings and deprecations</span><span>
</span><span id="line-570"></span><span>        </span><span id="tcg_anns"><span class="annot"><span class="annottext">TcGblEnv -&gt; [Annotation]
</span><a href="GHC.Tc.Types.html#tcg_anns"><span class="hs-identifier hs-var hs-var">tcg_anns</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Annotations.html#Annotation"><span class="hs-identifier hs-type">Annotation</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>       </span><span class="hs-comment">-- ...Annotations</span><span>
</span><span id="line-571"></span><span>        </span><span id="tcg_tcs"><span class="annot"><span class="annottext">TcGblEnv -&gt; [TyCon]
</span><a href="GHC.Tc.Types.html#tcg_tcs"><span class="hs-identifier hs-var hs-var">tcg_tcs</span></a></span></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- ...TyCons and Classes</span><span>
</span><span id="line-572"></span><span>        </span><span id="tcg_insts"><span class="annot"><span class="annottext">TcGblEnv -&gt; [ClsInst]
</span><a href="GHC.Tc.Types.html#tcg_insts"><span class="hs-identifier hs-var hs-var">tcg_insts</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.InstEnv.html#ClsInst"><span class="hs-identifier hs-type">ClsInst</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>          </span><span class="hs-comment">-- ...Instances</span><span>
</span><span id="line-573"></span><span>        </span><span id="tcg_fam_insts"><span class="annot"><span class="annottext">TcGblEnv -&gt; [FamInst]
</span><a href="GHC.Tc.Types.html#tcg_fam_insts"><span class="hs-identifier hs-var hs-var">tcg_fam_insts</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInst"><span class="hs-identifier hs-type">FamInst</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>          </span><span class="hs-comment">-- ...Family instances</span><span>
</span><span id="line-574"></span><span>        </span><span id="tcg_rules"><span class="annot"><span class="annottext">TcGblEnv -&gt; [LRuleDecl GhcTc]
</span><a href="GHC.Tc.Types.html#tcg_rules"><span class="hs-identifier hs-var hs-var">tcg_rules</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LRuleDecl"><span class="hs-identifier hs-type">LRuleDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>  </span><span class="hs-comment">-- ...Rules</span><span>
</span><span id="line-575"></span><span>        </span><span id="tcg_fords"><span class="annot"><span class="annottext">TcGblEnv -&gt; [LForeignDecl GhcTc]
</span><a href="GHC.Tc.Types.html#tcg_fords"><span class="hs-identifier hs-var hs-var">tcg_fords</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LForeignDecl"><span class="hs-identifier hs-type">LForeignDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- ...Foreign import &amp; exports</span><span>
</span><span id="line-576"></span><span>        </span><span id="tcg_patsyns"><span class="annot"><span class="annottext">TcGblEnv -&gt; [PatSyn]
</span><a href="GHC.Tc.Types.html#tcg_patsyns"><span class="hs-identifier hs-var hs-var">tcg_patsyns</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.PatSyn.html#PatSyn"><span class="hs-identifier hs-type">PatSyn</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- ...Pattern synonyms</span><span>
</span><span id="line-577"></span><span>
</span><span id="line-578"></span><span>        </span><span id="tcg_doc_hdr"><span class="annot"><span class="annottext">TcGblEnv -&gt; Maybe LHsDocString
</span><a href="GHC.Tc.Types.html#tcg_doc_hdr"><span class="hs-identifier hs-var hs-var">tcg_doc_hdr</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Doc.html#LHsDocString"><span class="hs-identifier hs-type">LHsDocString</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- ^ Maybe Haddock header docs</span><span>
</span><span id="line-579"></span><span>        </span><span id="tcg_hpc"><span class="annot"><span class="annottext">TcGblEnv -&gt; Bool
</span><a href="GHC.Tc.Types.html#tcg_hpc"><span class="hs-identifier hs-var hs-var">tcg_hpc</span></a></span></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Driver.Types.html#AnyHpcUsage"><span class="hs-identifier hs-type">AnyHpcUsage</span></a></span><span class="hs-special">,</span><span>       </span><span class="hs-comment">-- ^ @True@ if any part of the</span><span>
</span><span id="line-580"></span><span>                                             </span><span class="hs-comment">--  prog uses hpc instrumentation.</span><span>
</span><span id="line-581"></span><span>           </span><span class="hs-comment">-- NB. BangPattern is to fix a leak, see #15111</span><span>
</span><span id="line-582"></span><span>
</span><span id="line-583"></span><span>        </span><span id="tcg_self_boot"><span class="annot"><span class="annottext">TcGblEnv -&gt; SelfBootInfo
</span><a href="GHC.Tc.Types.html#tcg_self_boot"><span class="hs-identifier hs-var hs-var">tcg_self_boot</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#SelfBootInfo"><span class="hs-identifier hs-type">SelfBootInfo</span></a></span><span class="hs-special">,</span><span>       </span><span class="hs-comment">-- ^ Whether this module has a</span><span>
</span><span id="line-584"></span><span>                                             </span><span class="hs-comment">-- corresponding hi-boot file</span><span>
</span><span id="line-585"></span><span>
</span><span id="line-586"></span><span>        </span><span id="tcg_main"><span class="annot"><span class="annottext">TcGblEnv -&gt; Maybe Name
</span><a href="GHC.Tc.Types.html#tcg_main"><span class="hs-identifier hs-var hs-var">tcg_main</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span>         </span><span class="hs-comment">-- ^ The Name of the main</span><span>
</span><span id="line-587"></span><span>                                             </span><span class="hs-comment">-- function, if this module is</span><span>
</span><span id="line-588"></span><span>                                             </span><span class="hs-comment">-- the main module.</span><span>
</span><span id="line-589"></span><span>
</span><span id="line-590"></span><span>        </span><span id="tcg_safeInfer"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef (Bool, WarningMessages)
</span><a href="GHC.Tc.Types.html#tcg_safeInfer"><span class="hs-identifier hs-var hs-var">tcg_safeInfer</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#WarningMessages"><span class="hs-identifier hs-type">WarningMessages</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-591"></span><span>        </span><span class="hs-comment">-- ^ Has the typechecker inferred this module as -XSafe (Safe Haskell)</span><span>
</span><span id="line-592"></span><span>        </span><span class="hs-comment">-- See Note [Safe Haskell Overlapping Instances Implementation],</span><span>
</span><span id="line-593"></span><span>        </span><span class="hs-comment">-- although this is used for more than just that failure case.</span><span>
</span><span id="line-594"></span><span>
</span><span id="line-595"></span><span>        </span><span id="tcg_tc_plugins"><span class="annot"><span class="annottext">TcGblEnv -&gt; [TcPluginSolver]
</span><a href="GHC.Tc.Types.html#tcg_tc_plugins"><span class="hs-identifier hs-var hs-var">tcg_tc_plugins</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginSolver"><span class="hs-identifier hs-type">TcPluginSolver</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-596"></span><span>        </span><span class="hs-comment">-- ^ A list of user-defined plugins for the constraint solver.</span><span>
</span><span id="line-597"></span><span>        </span><span id="tcg_hf_plugins"><span class="annot"><span class="annottext">TcGblEnv -&gt; [HoleFitPlugin]
</span><a href="GHC.Tc.Types.html#tcg_hf_plugins"><span class="hs-identifier hs-var hs-var">tcg_hf_plugins</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Errors.Hole.FitTypes.html#HoleFitPlugin"><span class="hs-identifier hs-type">HoleFitPlugin</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-598"></span><span>        </span><span class="hs-comment">-- ^ A list of user-defined plugins for hole fit suggestions.</span><span>
</span><span id="line-599"></span><span>
</span><span id="line-600"></span><span>        </span><span id="tcg_top_loc"><span class="annot"><span class="annottext">TcGblEnv -&gt; RealSrcSpan
</span><a href="GHC.Tc.Types.html#tcg_top_loc"><span class="hs-identifier hs-var hs-var">tcg_top_loc</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcSpan"><span class="hs-identifier hs-type">RealSrcSpan</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-601"></span><span>        </span><span class="hs-comment">-- ^ The RealSrcSpan this module came from</span><span>
</span><span id="line-602"></span><span>
</span><span id="line-603"></span><span>        </span><span id="tcg_static_wc"><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef WantedConstraints
</span><a href="GHC.Tc.Types.html#tcg_static_wc"><span class="hs-identifier hs-var hs-var">tcg_static_wc</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-604"></span><span>          </span><span class="hs-comment">-- ^ Wanted constraints of static forms.</span><span>
</span><span id="line-605"></span><span>        </span><span class="hs-comment">-- See Note [Constraints in static forms].</span><span>
</span><span id="line-606"></span><span>        </span><span id="tcg_complete_matches"><span class="annot"><span class="annottext">TcGblEnv -&gt; [CompleteMatch]
</span><a href="GHC.Tc.Types.html#tcg_complete_matches"><span class="hs-identifier hs-var hs-var">tcg_complete_matches</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Driver.Types.html#CompleteMatch"><span class="hs-identifier hs-type">CompleteMatch</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-607"></span><span>
</span><span id="line-608"></span><span>        </span><span class="hs-comment">-- ^ Tracking indices for cost centre annotations</span><span>
</span><span id="line-609"></span><span>        </span><span id="tcg_cc_st"><span class="annot"><span class="annottext">TcGblEnv -&gt; IORef CostCentreState
</span><a href="GHC.Tc.Types.html#tcg_cc_st"><span class="hs-identifier hs-var hs-var">tcg_cc_st</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.State.html#CostCentreState"><span class="hs-identifier hs-type">CostCentreState</span></a></span><span>
</span><span id="line-610"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-611"></span><span>
</span><span id="line-612"></span><span class="hs-comment">-- NB: topModIdentity, not topModSemantic!</span><span>
</span><span id="line-613"></span><span class="hs-comment">-- Definition sites of orphan identities will be identity modules, not semantic</span><span>
</span><span id="line-614"></span><span class="hs-comment">-- modules.</span><span>
</span><span id="line-615"></span><span>
</span><span id="line-616"></span><span class="hs-comment">-- Note [Constraints in static forms]</span><span>
</span><span id="line-617"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-618"></span><span class="hs-comment">--</span><span>
</span><span id="line-619"></span><span class="hs-comment">-- When a static form produces constraints like</span><span>
</span><span id="line-620"></span><span class="hs-comment">--</span><span>
</span><span id="line-621"></span><span class="hs-comment">-- f :: StaticPtr (Bool -&gt; String)</span><span>
</span><span id="line-622"></span><span class="hs-comment">-- f = static show</span><span>
</span><span id="line-623"></span><span class="hs-comment">--</span><span>
</span><span id="line-624"></span><span class="hs-comment">-- we collect them in tcg_static_wc and resolve them at the end</span><span>
</span><span id="line-625"></span><span class="hs-comment">-- of type checking. They need to be resolved separately because</span><span>
</span><span id="line-626"></span><span class="hs-comment">-- we don't want to resolve them in the context of the enclosing</span><span>
</span><span id="line-627"></span><span class="hs-comment">-- expression. Consider</span><span>
</span><span id="line-628"></span><span class="hs-comment">--</span><span>
</span><span id="line-629"></span><span class="hs-comment">-- g :: Show a =&gt; StaticPtr (a -&gt; String)</span><span>
</span><span id="line-630"></span><span class="hs-comment">-- g = static show</span><span>
</span><span id="line-631"></span><span class="hs-comment">--</span><span>
</span><span id="line-632"></span><span class="hs-comment">-- If the @Show a0@ constraint that the body of the static form produces was</span><span>
</span><span id="line-633"></span><span class="hs-comment">-- resolved in the context of the enclosing expression, then the body of the</span><span>
</span><span id="line-634"></span><span class="hs-comment">-- static form wouldn't be closed because the Show dictionary would come from</span><span>
</span><span id="line-635"></span><span class="hs-comment">-- g's context instead of coming from the top level.</span><span>
</span><span id="line-636"></span><span>
</span><span id="line-637"></span><span class="annot"><a href="GHC.Tc.Types.html#tcVisibleOrphanMods"><span class="hs-identifier hs-type">tcVisibleOrphanMods</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Env.html#ModuleSet"><span class="hs-identifier hs-type">ModuleSet</span></a></span><span>
</span><span id="line-638"></span><span id="tcVisibleOrphanMods"><span class="annot"><span class="annottext">tcVisibleOrphanMods :: TcGblEnv -&gt; ModuleSet
</span><a href="GHC.Tc.Types.html#tcVisibleOrphanMods"><span class="hs-identifier hs-var hs-var">tcVisibleOrphanMods</span></a></span></span><span> </span><span id="local-6989586621680879841"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621680879841"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span>
</span><span id="line-639"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Module] -&gt; ModuleSet
</span><a href="GHC.Unit.Module.Env.html#mkModuleSet"><span class="hs-identifier hs-var">mkModuleSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_mod"><span class="hs-identifier hs-var hs-var">tcg_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621680879841"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; [Module] -&gt; [Module]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">ImportAvails -&gt; [Module]
</span><a href="GHC.Tc.Types.html#imp_orphs"><span class="hs-identifier hs-var hs-var">imp_orphs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#tcg_imports"><span class="hs-identifier hs-var hs-var">tcg_imports</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621680879841"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-640"></span><span>
</span><span id="line-641"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html#ContainsModule"><span class="hs-identifier hs-type">ContainsModule</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-642"></span><span>    </span><span id="local-6989586621680879836"><span class="annot"><span class="annottext">extractModule :: TcGblEnv -&gt; Module
</span><a href="#local-6989586621680879836"><span class="hs-identifier hs-var hs-var hs-var hs-var">extractModule</span></a></span></span><span> </span><span id="local-6989586621680879835"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621680879835"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_semantic_mod"><span class="hs-identifier hs-var hs-var">tcg_semantic_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621680879835"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-643"></span><span>
</span><span id="line-644"></span><span class="hs-keyword">type</span><span> </span><span id="RecFieldEnv"><span class="annot"><a href="GHC.Tc.Types.html#RecFieldEnv"><span class="hs-identifier hs-var">RecFieldEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-645"></span><span>        </span><span class="hs-comment">-- Maps a constructor name *in this module*</span><span>
</span><span id="line-646"></span><span>        </span><span class="hs-comment">-- to the fields for that constructor.</span><span>
</span><span id="line-647"></span><span>        </span><span class="hs-comment">-- This is used when dealing with &quot;..&quot; notation in record</span><span>
</span><span id="line-648"></span><span>        </span><span class="hs-comment">-- construction and pattern matching.</span><span>
</span><span id="line-649"></span><span>        </span><span class="hs-comment">-- The FieldEnv deals *only* with constructors defined in *this*</span><span>
</span><span id="line-650"></span><span>        </span><span class="hs-comment">-- module.  For imported modules, we get the same info from the</span><span>
</span><span id="line-651"></span><span>        </span><span class="hs-comment">-- TypeEnv</span><span>
</span><span id="line-652"></span><span>
</span><span id="line-653"></span><span class="hs-keyword">data</span><span> </span><span id="SelfBootInfo"><span class="annot"><a href="GHC.Tc.Types.html#SelfBootInfo"><span class="hs-identifier hs-var">SelfBootInfo</span></a></span></span><span>
</span><span id="line-654"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="NoSelfBoot"><span class="annot"><a href="GHC.Tc.Types.html#NoSelfBoot"><span class="hs-identifier hs-var">NoSelfBoot</span></a></span></span><span>    </span><span class="hs-comment">-- No corresponding hi-boot file</span><span>
</span><span id="line-655"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="SelfBoot"><span class="annot"><a href="GHC.Tc.Types.html#SelfBoot"><span class="hs-identifier hs-var">SelfBoot</span></a></span></span><span>
</span><span id="line-656"></span><span>       </span><span class="hs-special">{</span><span> </span><span id="sb_mds"><span class="annot"><span class="annottext">SelfBootInfo -&gt; ModDetails
</span><a href="GHC.Tc.Types.html#sb_mds"><span class="hs-identifier hs-var hs-var">sb_mds</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModDetails"><span class="hs-identifier hs-type">ModDetails</span></a></span><span>   </span><span class="hs-comment">-- There was a hi-boot file,</span><span>
</span><span id="line-657"></span><span>       </span><span class="hs-special">,</span><span> </span><span id="sb_tcs"><span class="annot"><span class="annottext">SelfBootInfo -&gt; NameSet
</span><a href="GHC.Tc.Types.html#sb_tcs"><span class="hs-identifier hs-var hs-var">sb_tcs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span> </span><span class="hs-special">}</span><span>    </span><span class="hs-comment">-- defining these TyCons,</span><span>
</span><span id="line-658"></span><span class="hs-comment">-- What is sb_tcs used for?  See Note [Extra dependencies from .hs-boot files]</span><span>
</span><span id="line-659"></span><span class="hs-comment">-- in GHC.Rename.Module</span><span>
</span><span id="line-660"></span><span>
</span><span id="line-661"></span><span>
</span><span id="line-662"></span><span class="hs-comment">{- Note [Tracking unused binding and imports]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We gather three sorts of usage information

 * tcg_dus :: DefUses (defs/uses)
      Records what is defined in this module and what is used.

      Records *defined* Names (local, top-level)
          and *used*    Names (local or imported)

      Used (a) to report &quot;defined but not used&quot;
               (see GHC.Rename.Names.reportUnusedNames)
           (b) to generate version-tracking usage info in interface
               files (see GHC.Iface.Make.mkUsedNames)
   This usage info is mainly gathered by the renamer's
   gathering of free-variables

 * tcg_used_gres :: TcRef [GlobalRdrElt]
      Records occurrences of imported entities.

      Used only to report unused import declarations

      Records each *occurrence* an *imported* (not locally-defined) entity.
      The occurrence is recorded by keeping a GlobalRdrElt for it.
      These is not the GRE that is in the GlobalRdrEnv; rather it
      is recorded *after* the filtering done by pickGREs.  So it reflect
      /how that occurrence is in scope/.   See Note [GRE filtering] in
      RdrName.

  * tcg_keep :: TcRef NameSet
      Records names of the type constructors, data constructors, and Ids that
      are used by the constraint solver.

      The typechecker may use find that some imported or
      locally-defined things are used, even though they
      do not appear to be mentioned in the source code:

      (a) The to/from functions for generic data types

      (b) Top-level variables appearing free in the RHS of an
          orphan rule

      (c) Top-level variables appearing free in a TH bracket
          See Note [Keeping things alive for Template Haskell]
          in GHC.Rename.Splice

      (d) The data constructor of a newtype that is used
          to solve a Coercible instance (e.g. #10347). Example
              module T10347 (N, mkN) where
                import Data.Coerce
                newtype N a = MkN Int
                mkN :: Int -&gt; N a
                mkN = coerce

          Then we wish to record `MkN` as used, since it is (morally)
          used to perform the coercion in `mkN`. To do so, the
          Coercible solver updates tcg_keep's TcRef whenever it
          encounters a use of `coerce` that crosses newtype boundaries.

      The tcg_keep field is used in two distinct ways:

      * Desugar.addExportFlagsAndRules.  Where things like (a-c) are locally
        defined, we should give them an Exported flag, so that the
        simplifier does not discard them as dead code, and so that they are
        exposed in the interface file (but not to export to the user).

      * GHC.Rename.Names.reportUnusedNames.  Where newtype data constructors
        like (d) are imported, we don't want to report them as unused.


************************************************************************
*                                                                      *
                The local typechecker environment
*                                                                      *
************************************************************************

Note [The Global-Env/Local-Env story]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
During type checking, we keep in the tcg_type_env
        * All types and classes
        * All Ids derived from types and classes (constructors, selectors)

At the end of type checking, we zonk the local bindings,
and as we do so we add to the tcg_type_env
        * Locally defined top-level Ids

Why?  Because they are now Ids not TcIds.  This final GlobalEnv is
        a) fed back (via the knot) to typechecking the
           unfoldings of interface signatures
        b) used in the ModDetails of this module
-}</span><span>
</span><span id="line-753"></span><span>
</span><span id="line-754"></span><span class="hs-keyword">data</span><span> </span><span id="TcLclEnv"><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-var">TcLclEnv</span></a></span></span><span>           </span><span class="hs-comment">-- Changes as we move inside an expression</span><span>
</span><span id="line-755"></span><span>                        </span><span class="hs-comment">-- Discarded after typecheck/rename; not passed on to desugarer</span><span>
</span><span id="line-756"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="TcLclEnv"><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-var">TcLclEnv</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-757"></span><span>        </span><span id="tcl_loc"><span class="annot"><span class="annottext">TcLclEnv -&gt; RealSrcSpan
</span><a href="GHC.Tc.Types.html#tcl_loc"><span class="hs-identifier hs-var hs-var">tcl_loc</span></a></span></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcSpan"><span class="hs-identifier hs-type">RealSrcSpan</span></a></span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- Source span</span><span>
</span><span id="line-758"></span><span>        </span><span id="tcl_ctxt"><span class="annot"><span class="annottext">TcLclEnv -&gt; [ErrCtxt]
</span><a href="GHC.Tc.Types.html#tcl_ctxt"><span class="hs-identifier hs-var hs-var">tcl_ctxt</span></a></span></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.html#ErrCtxt"><span class="hs-identifier hs-type">ErrCtxt</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>       </span><span class="hs-comment">-- Error context, innermost on top</span><span>
</span><span id="line-759"></span><span>        </span><span id="tcl_in_gen_code"><span class="annot"><span class="annottext">TcLclEnv -&gt; Bool
</span><a href="GHC.Tc.Types.html#tcl_in_gen_code"><span class="hs-identifier hs-var hs-var">tcl_in_gen_code</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span>           </span><span class="hs-comment">-- See Note [Rebindable syntax and HsExpansion]</span><span>
</span><span id="line-760"></span><span>        </span><span id="tcl_tclvl"><span class="annot"><span class="annottext">TcLclEnv -&gt; TcLevel
</span><a href="GHC.Tc.Types.html#tcl_tclvl"><span class="hs-identifier hs-var hs-var">tcl_tclvl</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-761"></span><span>
</span><span id="line-762"></span><span>        </span><span id="tcl_th_ctxt"><span class="annot"><span class="annottext">TcLclEnv -&gt; ThStage
</span><a href="GHC.Tc.Types.html#tcl_th_ctxt"><span class="hs-identifier hs-var hs-var">tcl_th_ctxt</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ThStage"><span class="hs-identifier hs-type">ThStage</span></a></span><span class="hs-special">,</span><span>         </span><span class="hs-comment">-- Template Haskell context</span><span>
</span><span id="line-763"></span><span>        </span><span id="tcl_th_bndrs"><span class="annot"><span class="annottext">TcLclEnv -&gt; ThBindEnv
</span><a href="GHC.Tc.Types.html#tcl_th_bndrs"><span class="hs-identifier hs-var hs-var">tcl_th_bndrs</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ThBindEnv"><span class="hs-identifier hs-type">ThBindEnv</span></a></span><span class="hs-special">,</span><span>       </span><span class="hs-comment">-- and binder info</span><span>
</span><span id="line-764"></span><span>            </span><span class="hs-comment">-- The ThBindEnv records the TH binding level of in-scope Names</span><span>
</span><span id="line-765"></span><span>            </span><span class="hs-comment">-- defined in this module (not imported)</span><span>
</span><span id="line-766"></span><span>            </span><span class="hs-comment">-- We can't put this info in the TypeEnv because it's needed</span><span>
</span><span id="line-767"></span><span>            </span><span class="hs-comment">-- (and extended) in the renamer, for untyed splices</span><span>
</span><span id="line-768"></span><span>
</span><span id="line-769"></span><span>        </span><span id="tcl_arrow_ctxt"><span class="annot"><span class="annottext">TcLclEnv -&gt; ArrowCtxt
</span><a href="GHC.Tc.Types.html#tcl_arrow_ctxt"><span class="hs-identifier hs-var hs-var">tcl_arrow_ctxt</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ArrowCtxt"><span class="hs-identifier hs-type">ArrowCtxt</span></a></span><span class="hs-special">,</span><span>       </span><span class="hs-comment">-- Arrow-notation context</span><span>
</span><span id="line-770"></span><span>
</span><span id="line-771"></span><span>        </span><span id="tcl_rdr"><span class="annot"><span class="annottext">TcLclEnv -&gt; LocalRdrEnv
</span><a href="GHC.Tc.Types.html#tcl_rdr"><span class="hs-identifier hs-var hs-var">tcl_rdr</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#LocalRdrEnv"><span class="hs-identifier hs-type">LocalRdrEnv</span></a></span><span class="hs-special">,</span><span>         </span><span class="hs-comment">-- Local name envt</span><span>
</span><span id="line-772"></span><span>                </span><span class="hs-comment">-- Maintained during renaming, of course, but also during</span><span>
</span><span id="line-773"></span><span>                </span><span class="hs-comment">-- type checking, solely so that when renaming a Template-Haskell</span><span>
</span><span id="line-774"></span><span>                </span><span class="hs-comment">-- splice we have the right environment for the renamer.</span><span>
</span><span id="line-775"></span><span>                </span><span class="hs-comment">--</span><span>
</span><span id="line-776"></span><span>                </span><span class="hs-comment">--   Does *not* include global name envt; may shadow it</span><span>
</span><span id="line-777"></span><span>                </span><span class="hs-comment">--   Includes both ordinary variables and type variables;</span><span>
</span><span id="line-778"></span><span>                </span><span class="hs-comment">--   they are kept distinct because tyvar have a different</span><span>
</span><span id="line-779"></span><span>                </span><span class="hs-comment">--   occurrence constructor (Name.TvOcc)</span><span>
</span><span id="line-780"></span><span>                </span><span class="hs-comment">-- We still need the unsullied global name env so that</span><span>
</span><span id="line-781"></span><span>                </span><span class="hs-comment">--   we can look up record field names</span><span>
</span><span id="line-782"></span><span>
</span><span id="line-783"></span><span>        </span><span id="tcl_env"><span class="annot"><span class="annottext">TcLclEnv -&gt; TcTypeEnv
</span><a href="GHC.Tc.Types.html#tcl_env"><span class="hs-identifier hs-var hs-var">tcl_env</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcTypeEnv"><span class="hs-identifier hs-type">TcTypeEnv</span></a></span><span class="hs-special">,</span><span>    </span><span class="hs-comment">-- The local type environment:</span><span>
</span><span id="line-784"></span><span>                                  </span><span class="hs-comment">-- Ids and TyVars defined in this module</span><span>
</span><span id="line-785"></span><span>
</span><span id="line-786"></span><span>        </span><span id="tcl_usage"><span class="annot"><span class="annottext">TcLclEnv -&gt; TcRef UsageEnv
</span><a href="GHC.Tc.Types.html#tcl_usage"><span class="hs-identifier hs-var hs-var">tcl_usage</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><a href="GHC.Core.UsageEnv.html#UsageEnv"><span class="hs-identifier hs-type">UsageEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- Required multiplicity of bindings is accumulated here.</span><span>
</span><span id="line-787"></span><span>
</span><span id="line-788"></span><span>
</span><span id="line-789"></span><span>        </span><span id="tcl_bndrs"><span class="annot"><span class="annottext">TcLclEnv -&gt; TcBinderStack
</span><a href="GHC.Tc.Types.html#tcl_bndrs"><span class="hs-identifier hs-var hs-var">tcl_bndrs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcBinderStack"><span class="hs-identifier hs-type">TcBinderStack</span></a></span><span class="hs-special">,</span><span>   </span><span class="hs-comment">-- Used for reporting relevant bindings,</span><span>
</span><span id="line-790"></span><span>                                      </span><span class="hs-comment">-- and for tidying types</span><span>
</span><span id="line-791"></span><span>
</span><span id="line-792"></span><span>        </span><span id="tcl_lie"><span class="annot"><span class="annottext">TcLclEnv -&gt; TcRef WantedConstraints
</span><a href="GHC.Tc.Types.html#tcl_lie"><span class="hs-identifier hs-var hs-var">tcl_lie</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span class="hs-special">,</span><span>    </span><span class="hs-comment">-- Place to accumulate type constraints</span><span>
</span><span id="line-793"></span><span>        </span><span id="tcl_errs"><span class="annot"><span class="annottext">TcLclEnv -&gt; IORef Messages
</span><a href="GHC.Tc.Types.html#tcl_errs"><span class="hs-identifier hs-var hs-var">tcl_errs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span>              </span><span class="hs-comment">-- Place to accumulate errors</span><span>
</span><span id="line-794"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-795"></span><span>
</span><span id="line-796"></span><span class="annot"><a href="GHC.Tc.Types.html#setLclEnvTcLevel"><span class="hs-identifier hs-type">setLclEnvTcLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span>
</span><span id="line-797"></span><span id="setLclEnvTcLevel"><span class="annot"><span class="annottext">setLclEnvTcLevel :: TcLclEnv -&gt; TcLevel -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.html#setLclEnvTcLevel"><span class="hs-identifier hs-var hs-var">setLclEnvTcLevel</span></a></span></span><span> </span><span id="local-6989586621680879816"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680879816"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680879815"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680879815"><span class="hs-identifier hs-var">lvl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680879816"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcl_tclvl :: TcLevel
</span><a href="GHC.Tc.Types.html#tcl_tclvl"><span class="hs-identifier hs-var">tcl_tclvl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680879815"><span class="hs-identifier hs-var">lvl</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-798"></span><span>
</span><span id="line-799"></span><span class="annot"><a href="GHC.Tc.Types.html#getLclEnvTcLevel"><span class="hs-identifier hs-type">getLclEnvTcLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span>
</span><span id="line-800"></span><span id="getLclEnvTcLevel"><span class="annot"><span class="annottext">getLclEnvTcLevel :: TcLclEnv -&gt; TcLevel
</span><a href="GHC.Tc.Types.html#getLclEnvTcLevel"><span class="hs-identifier hs-var hs-var">getLclEnvTcLevel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv -&gt; TcLevel
</span><a href="GHC.Tc.Types.html#tcl_tclvl"><span class="hs-identifier hs-var hs-var">tcl_tclvl</span></a></span><span>
</span><span id="line-801"></span><span>
</span><span id="line-802"></span><span class="annot"><a href="GHC.Tc.Types.html#setLclEnvLoc"><span class="hs-identifier hs-type">setLclEnvLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcSpan"><span class="hs-identifier hs-type">RealSrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span>
</span><span id="line-803"></span><span id="setLclEnvLoc"><span class="annot"><span class="annottext">setLclEnvLoc :: TcLclEnv -&gt; RealSrcSpan -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.html#setLclEnvLoc"><span class="hs-identifier hs-var hs-var">setLclEnvLoc</span></a></span></span><span> </span><span id="local-6989586621680879814"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680879814"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680879813"><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621680879813"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680879814"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcl_loc :: RealSrcSpan
</span><a href="GHC.Tc.Types.html#tcl_loc"><span class="hs-identifier hs-var">tcl_loc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621680879813"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-804"></span><span>
</span><span id="line-805"></span><span class="annot"><a href="GHC.Tc.Types.html#getLclEnvLoc"><span class="hs-identifier hs-type">getLclEnvLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcSpan"><span class="hs-identifier hs-type">RealSrcSpan</span></a></span><span>
</span><span id="line-806"></span><span id="getLclEnvLoc"><span class="annot"><span class="annottext">getLclEnvLoc :: TcLclEnv -&gt; RealSrcSpan
</span><a href="GHC.Tc.Types.html#getLclEnvLoc"><span class="hs-identifier hs-var hs-var">getLclEnvLoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv -&gt; RealSrcSpan
</span><a href="GHC.Tc.Types.html#tcl_loc"><span class="hs-identifier hs-var hs-var">tcl_loc</span></a></span><span>
</span><span id="line-807"></span><span>
</span><span id="line-808"></span><span class="hs-keyword">type</span><span> </span><span id="ErrCtxt"><span class="annot"><a href="GHC.Tc.Types.html#ErrCtxt"><span class="hs-identifier hs-var">ErrCtxt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#TidyEnv"><span class="hs-identifier hs-type">TidyEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Env.html#TidyEnv"><span class="hs-identifier hs-type">TidyEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#MsgDoc"><span class="hs-identifier hs-type">MsgDoc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-809"></span><span>        </span><span class="hs-comment">-- Monadic so that we have a chance</span><span>
</span><span id="line-810"></span><span>        </span><span class="hs-comment">-- to deal with bound type variables just before error</span><span>
</span><span id="line-811"></span><span>        </span><span class="hs-comment">-- message construction</span><span>
</span><span id="line-812"></span><span>
</span><span id="line-813"></span><span>        </span><span class="hs-comment">-- Bool:  True &lt;=&gt; this is a landmark context; do not</span><span>
</span><span id="line-814"></span><span>        </span><span class="hs-comment">--                 discard it when trimming for display</span><span>
</span><span id="line-815"></span><span>
</span><span id="line-816"></span><span class="hs-comment">-- These are here to avoid module loops: one might expect them</span><span>
</span><span id="line-817"></span><span class="hs-comment">-- in GHC.Tc.Types.Constraint, but they refer to ErrCtxt which refers to TcM.</span><span>
</span><span id="line-818"></span><span class="hs-comment">-- Easier to just keep these definitions here, alongside TcM.</span><span>
</span><span id="line-819"></span><span class="annot"><a href="GHC.Tc.Types.html#pushErrCtxt"><span class="hs-identifier hs-type">pushErrCtxt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#CtOrigin"><span class="hs-identifier hs-type">CtOrigin</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ErrCtxt"><span class="hs-identifier hs-type">ErrCtxt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-820"></span><span id="pushErrCtxt"><span class="annot"><span class="annottext">pushErrCtxt :: CtOrigin -&gt; ErrCtxt -&gt; CtLoc -&gt; CtLoc
</span><a href="GHC.Tc.Types.html#pushErrCtxt"><span class="hs-identifier hs-var hs-var">pushErrCtxt</span></a></span></span><span> </span><span id="local-6989586621680879810"><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680879810"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span id="local-6989586621680879809"><span class="annot"><span class="annottext">ErrCtxt
</span><a href="#local-6989586621680879809"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span id="local-6989586621680879808"><span class="annot"><span class="annottext">loc :: CtLoc
</span><a href="#local-6989586621680879808"><span class="hs-identifier hs-var">loc</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_env :: CtLoc -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctl_env"><span class="hs-identifier hs-var">ctl_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879805"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680879805"><span class="hs-identifier hs-var">lcl</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-821"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680879808"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_origin :: CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctl_origin"><span class="hs-identifier hs-var">ctl_origin</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680879810"><span class="hs-identifier hs-var">o</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ctl_env :: TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctl_env"><span class="hs-identifier hs-var">ctl_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680879805"><span class="hs-identifier hs-var">lcl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcl_ctxt :: [ErrCtxt]
</span><a href="GHC.Tc.Types.html#tcl_ctxt"><span class="hs-identifier hs-var">tcl_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ErrCtxt
</span><a href="#local-6989586621680879809"><span class="hs-identifier hs-var">err</span></a></span><span> </span><span class="annot"><span class="annottext">ErrCtxt -&gt; [ErrCtxt] -&gt; [ErrCtxt]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">TcLclEnv -&gt; [ErrCtxt]
</span><a href="GHC.Tc.Types.html#tcl_ctxt"><span class="hs-identifier hs-var hs-var">tcl_ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680879805"><span class="hs-identifier hs-var">lcl</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-822"></span><span>
</span><span id="line-823"></span><span class="annot"><a href="GHC.Tc.Types.html#pushErrCtxtSameOrigin"><span class="hs-identifier hs-type">pushErrCtxtSameOrigin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ErrCtxt"><span class="hs-identifier hs-type">ErrCtxt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-824"></span><span class="hs-comment">-- Just add information w/o updating the origin!</span><span>
</span><span id="line-825"></span><span id="pushErrCtxtSameOrigin"><span class="annot"><span class="annottext">pushErrCtxtSameOrigin :: ErrCtxt -&gt; CtLoc -&gt; CtLoc
</span><a href="GHC.Tc.Types.html#pushErrCtxtSameOrigin"><span class="hs-identifier hs-var hs-var">pushErrCtxtSameOrigin</span></a></span></span><span> </span><span id="local-6989586621680879803"><span class="annot"><span class="annottext">ErrCtxt
</span><a href="#local-6989586621680879803"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span id="local-6989586621680879802"><span class="annot"><span class="annottext">loc :: CtLoc
</span><a href="#local-6989586621680879802"><span class="hs-identifier hs-var">loc</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_env :: CtLoc -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctl_env"><span class="hs-identifier hs-var">ctl_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879801"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680879801"><span class="hs-identifier hs-var">lcl</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-826"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680879802"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_env :: TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctl_env"><span class="hs-identifier hs-var">ctl_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680879801"><span class="hs-identifier hs-var">lcl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcl_ctxt :: [ErrCtxt]
</span><a href="GHC.Tc.Types.html#tcl_ctxt"><span class="hs-identifier hs-var">tcl_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ErrCtxt
</span><a href="#local-6989586621680879803"><span class="hs-identifier hs-var">err</span></a></span><span> </span><span class="annot"><span class="annottext">ErrCtxt -&gt; [ErrCtxt] -&gt; [ErrCtxt]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">TcLclEnv -&gt; [ErrCtxt]
</span><a href="GHC.Tc.Types.html#tcl_ctxt"><span class="hs-identifier hs-var hs-var">tcl_ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680879801"><span class="hs-identifier hs-var">lcl</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-827"></span><span>
</span><span id="line-828"></span><span class="hs-keyword">type</span><span> </span><span id="TcTypeEnv"><span class="annot"><a href="GHC.Tc.Types.html#TcTypeEnv"><span class="hs-identifier hs-var">TcTypeEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcTyThing"><span class="hs-identifier hs-type">TcTyThing</span></a></span><span>
</span><span id="line-829"></span><span>
</span><span id="line-830"></span><span class="hs-keyword">type</span><span> </span><span id="ThBindEnv"><span class="annot"><a href="GHC.Tc.Types.html#ThBindEnv"><span class="hs-identifier hs-var">ThBindEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ThLevel"><span class="hs-identifier hs-type">ThLevel</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-831"></span><span>   </span><span class="hs-comment">-- Domain = all Ids bound in this module (ie not imported)</span><span>
</span><span id="line-832"></span><span>   </span><span class="hs-comment">-- The TopLevelFlag tells if the binding is syntactically top level.</span><span>
</span><span id="line-833"></span><span>   </span><span class="hs-comment">-- We need to know this, because the cross-stage persistence story allows</span><span>
</span><span id="line-834"></span><span>   </span><span class="hs-comment">-- cross-stage at arbitrary types if the Id is bound at top level.</span><span>
</span><span id="line-835"></span><span>   </span><span class="hs-comment">--</span><span>
</span><span id="line-836"></span><span>   </span><span class="hs-comment">-- Nota bene: a ThLevel of 'outerLevel' is *not* the same as being</span><span>
</span><span id="line-837"></span><span>   </span><span class="hs-comment">-- bound at top level!  See Note [Template Haskell levels] in GHC.Tc.Gen.Splice</span><span>
</span><span id="line-838"></span><span>
</span><span id="line-839"></span><span class="hs-comment">{- Note [Given Insts]
   ~~~~~~~~~~~~~~~~~~
Because of GADTs, we have to pass inwards the Insts provided by type signatures
and existential contexts. Consider
        data T a where { T1 :: b -&gt; b -&gt; T [b] }
        f :: Eq a =&gt; T a -&gt; Bool
        f (T1 x y) = [x]==[y]

The constructor T1 binds an existential variable 'b', and we need Eq [b].
Well, we have it, because Eq a refines to Eq [b], but we can only spot that if we
pass it inwards.

-}</span><span>
</span><span id="line-852"></span><span>
</span><span id="line-853"></span><span class="hs-comment">-- | Type alias for 'IORef'; the convention is we'll use this for mutable</span><span>
</span><span id="line-854"></span><span class="hs-comment">-- bits of data in 'TcGblEnv' which are updated during typechecking and</span><span>
</span><span id="line-855"></span><span class="hs-comment">-- returned at the end.</span><span>
</span><span id="line-856"></span><span class="hs-keyword">type</span><span> </span><span id="TcRef"><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-var">TcRef</span></a></span></span><span> </span><span id="local-6989586621680879800"><span class="annot"><a href="#local-6989586621680879800"><span class="hs-identifier hs-type">a</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680879800"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-857"></span><span class="hs-comment">-- ToDo: when should I refer to it as a 'TcId' instead of an 'Id'?</span><span>
</span><span id="line-858"></span><span class="hs-keyword">type</span><span> </span><span id="TcId"><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-var">TcId</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-859"></span><span class="hs-keyword">type</span><span> </span><span id="TcIdSet"><span class="annot"><a href="GHC.Tc.Types.html#TcIdSet"><span class="hs-identifier hs-var">TcIdSet</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#IdSet"><span class="hs-identifier hs-type">IdSet</span></a></span><span>
</span><span id="line-860"></span><span>
</span><span id="line-861"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-862"></span><span class="hs-comment">-- The TcBinderStack</span><span>
</span><span id="line-863"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-864"></span><span>
</span><span id="line-865"></span><span class="hs-keyword">type</span><span> </span><span id="TcBinderStack"><span class="annot"><a href="GHC.Tc.Types.html#TcBinderStack"><span class="hs-identifier hs-var">TcBinderStack</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.html#TcBinder"><span class="hs-identifier hs-type">TcBinder</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-866"></span><span>   </span><span class="hs-comment">-- This is a stack of locally-bound ids and tyvars,</span><span>
</span><span id="line-867"></span><span>   </span><span class="hs-comment">--   innermost on top</span><span>
</span><span id="line-868"></span><span>   </span><span class="hs-comment">-- Used only in error reporting (relevantBindings in TcError),</span><span>
</span><span id="line-869"></span><span>   </span><span class="hs-comment">--   and in tidying</span><span>
</span><span id="line-870"></span><span>   </span><span class="hs-comment">-- We can't use the tcl_env type environment, because it doesn't</span><span>
</span><span id="line-871"></span><span>   </span><span class="hs-comment">--   keep track of the nesting order</span><span>
</span><span id="line-872"></span><span>
</span><span id="line-873"></span><span class="hs-keyword">data</span><span> </span><span id="TcBinder"><span class="annot"><a href="GHC.Tc.Types.html#TcBinder"><span class="hs-identifier hs-var">TcBinder</span></a></span></span><span>
</span><span id="line-874"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="TcIdBndr"><span class="annot"><a href="GHC.Tc.Types.html#TcIdBndr"><span class="hs-identifier hs-var">TcIdBndr</span></a></span></span><span>
</span><span id="line-875"></span><span>       </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span>
</span><span id="line-876"></span><span>       </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span>    </span><span class="hs-comment">-- Tells whether the binding is syntactically top-level</span><span>
</span><span id="line-877"></span><span>                       </span><span class="hs-comment">-- (The monomorphic Ids for a recursive group count</span><span>
</span><span id="line-878"></span><span>                       </span><span class="hs-comment">--  as not-top-level for this purpose.)</span><span>
</span><span id="line-879"></span><span>
</span><span id="line-880"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="TcIdBndr_ExpType"><span class="annot"><a href="GHC.Tc.Types.html#TcIdBndr_ExpType"><span class="hs-identifier hs-var">TcIdBndr_ExpType</span></a></span></span><span>  </span><span class="hs-comment">-- Variant that allows the type to be specified as</span><span>
</span><span id="line-881"></span><span>                      </span><span class="hs-comment">-- an ExpType</span><span>
</span><span id="line-882"></span><span>       </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-883"></span><span>       </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpType"><span class="hs-identifier hs-type">ExpType</span></a></span><span>
</span><span id="line-884"></span><span>       </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span>
</span><span id="line-885"></span><span>
</span><span id="line-886"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="TcTvBndr"><span class="annot"><a href="GHC.Tc.Types.html#TcTvBndr"><span class="hs-identifier hs-var">TcTvBndr</span></a></span></span><span>          </span><span class="hs-comment">-- e.g.   case x of P (y::a) -&gt; blah</span><span>
</span><span id="line-887"></span><span>       </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>           </span><span class="hs-comment">-- We bind the lexical name &quot;a&quot; to the type of y,</span><span>
</span><span id="line-888"></span><span>       </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span>          </span><span class="hs-comment">-- which might be an utterly different (perhaps</span><span>
</span><span id="line-889"></span><span>                      </span><span class="hs-comment">-- existential) tyvar</span><span>
</span><span id="line-890"></span><span>
</span><span id="line-891"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879793"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcBinder"><span class="hs-identifier hs-type">TcBinder</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-892"></span><span>   </span><span id="local-6989586621680879782"><span class="annot"><span class="annottext">ppr :: TcBinder -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcIdBndr"><span class="hs-identifier hs-type">TcIdBndr</span></a></span><span> </span><span id="local-6989586621680879780"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879780"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span id="local-6989586621680879779"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680879779"><span class="hs-identifier hs-var">top_lvl</span></a></span></span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879780"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#brackets"><span class="hs-identifier hs-var">brackets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TopLevelFlag -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680879779"><span class="hs-identifier hs-var">top_lvl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-893"></span><span>   </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcIdBndr_ExpType"><span class="hs-identifier hs-type">TcIdBndr_ExpType</span></a></span><span> </span><span id="local-6989586621680879776"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879776"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="annot"><span class="annottext">ExpType
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680879775"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680879775"><span class="hs-identifier hs-var">top_lvl</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879776"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#brackets"><span class="hs-identifier hs-var">brackets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TopLevelFlag -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680879775"><span class="hs-identifier hs-var">top_lvl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-894"></span><span>   </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcTvBndr"><span class="hs-identifier hs-type">TcTvBndr</span></a></span><span> </span><span id="local-6989586621680879774"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879774"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span id="local-6989586621680879773"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879773"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">)</span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879774"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879773"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-895"></span><span>
</span><span id="line-896"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#HasOccName"><span class="hs-identifier hs-type">HasOccName</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcBinder"><span class="hs-identifier hs-type">TcBinder</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-897"></span><span>    </span><span id="local-6989586621680879764"><span class="annot"><span class="annottext">occName :: TcBinder -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var hs-var hs-var hs-var">occName</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcIdBndr"><span class="hs-identifier hs-type">TcIdBndr</span></a></span><span> </span><span id="local-6989586621680879762"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879762"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879762"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-898"></span><span>    </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcIdBndr_ExpType"><span class="hs-identifier hs-type">TcIdBndr_ExpType</span></a></span><span> </span><span id="local-6989586621680879761"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879761"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="annot"><span class="annottext">ExpType
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879761"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-899"></span><span>    </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcTvBndr"><span class="hs-identifier hs-type">TcTvBndr</span></a></span><span> </span><span id="local-6989586621680879760"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879760"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879760"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-900"></span><span>
</span><span id="line-901"></span><span class="hs-comment">-- fixes #12177</span><span>
</span><span id="line-902"></span><span class="hs-comment">-- Builds up a list of bindings whose OccName has not been seen before</span><span>
</span><span id="line-903"></span><span class="hs-comment">-- i.e., If    ys  = removeBindingShadowing xs</span><span>
</span><span id="line-904"></span><span class="hs-comment">-- then</span><span>
</span><span id="line-905"></span><span class="hs-comment">--  - ys is obtained from xs by deleting some elements</span><span>
</span><span id="line-906"></span><span class="hs-comment">--  - ys has no duplicate OccNames</span><span>
</span><span id="line-907"></span><span class="hs-comment">--  - The first duplicated OccName in xs is retained in ys</span><span>
</span><span id="line-908"></span><span class="hs-comment">-- Overloaded so that it can be used for both GlobalRdrElt in typed-hole</span><span>
</span><span id="line-909"></span><span class="hs-comment">-- substitutions and TcBinder when looking for relevant bindings.</span><span>
</span><span id="line-910"></span><span id="local-6989586621680880222"><span class="annot"><a href="GHC.Tc.Types.html#removeBindingShadowing"><span class="hs-identifier hs-type">removeBindingShadowing</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#HasOccName"><span class="hs-identifier hs-type">HasOccName</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680880222"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680880222"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680880222"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-911"></span><span id="removeBindingShadowing"><span class="annot"><span class="annottext">removeBindingShadowing :: forall a. HasOccName a =&gt; [a] -&gt; [a]
</span><a href="GHC.Tc.Types.html#removeBindingShadowing"><span class="hs-identifier hs-var hs-var">removeBindingShadowing</span></a></span></span><span> </span><span id="local-6989586621680879755"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680879755"><span class="hs-identifier hs-var">bindings</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">([a] -&gt; [a]) -&gt; [a] -&gt; [a]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">([a], OccSet) -&gt; [a]
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">(([a], OccSet) -&gt; [a]) -&gt; ([a], OccSet) -&gt; [a]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(([a], OccSet) -&gt; a -&gt; ([a], OccSet))
-&gt; ([a], OccSet) -&gt; [a] -&gt; ([a], OccSet)
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span>
</span><span id="line-912"></span><span>    </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621680879752"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680879752"><span class="hs-identifier hs-var">bindingAcc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680879751"><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621680879751"><span class="hs-identifier hs-var">seenNames</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680879750"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680879750"><span class="hs-identifier hs-var">binding</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-913"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680879750"><span class="hs-identifier hs-var">binding</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccSet -&gt; Bool
</span><a href="GHC.Types.Name.Occurrence.html#elemOccSet"><span class="hs-operator hs-var">`elemOccSet`</span></a></span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621680879751"><span class="hs-identifier hs-var">seenNames</span></a></span><span> </span><span class="hs-comment">-- if we've seen it</span><span>
</span><span id="line-914"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680879752"><span class="hs-identifier hs-var">bindingAcc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621680879751"><span class="hs-identifier hs-var">seenNames</span></a></span><span class="hs-special">)</span><span>              </span><span class="hs-comment">-- skip it</span><span>
</span><span id="line-915"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680879750"><span class="hs-identifier hs-var">binding</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680879752"><span class="hs-identifier hs-var">bindingAcc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OccSet -&gt; OccName -&gt; OccSet
</span><a href="GHC.Types.Name.Occurrence.html#extendOccSet"><span class="hs-identifier hs-var">extendOccSet</span></a></span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621680879751"><span class="hs-identifier hs-var">seenNames</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680879750"><span class="hs-identifier hs-var">binding</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-916"></span><span>    </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="GHC.Types.Name.Occurrence.html#emptyOccSet"><span class="hs-identifier hs-var">emptyOccSet</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680879755"><span class="hs-identifier hs-var">bindings</span></a></span><span>
</span><span id="line-917"></span><span>
</span><span id="line-918"></span><span>
</span><span id="line-919"></span><span class="hs-comment">-- | Get target platform</span><span>
</span><span id="line-920"></span><span class="annot"><a href="GHC.Tc.Types.html#getPlatform"><span class="hs-identifier hs-type">getPlatform</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span>
</span><span id="line-921"></span><span id="getPlatform"><span class="annot"><span class="annottext">getPlatform :: TcM Platform
</span><a href="GHC.Tc.Types.html#getPlatform"><span class="hs-identifier hs-var hs-var">getPlatform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">(DynFlags -&gt; Platform)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) DynFlags -&gt; TcM Platform
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-922"></span><span>
</span><span id="line-923"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-924"></span><span class="hs-comment">-- Template Haskell stages and levels</span><span>
</span><span id="line-925"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-926"></span><span>
</span><span id="line-927"></span><span class="hs-keyword">data</span><span> </span><span id="SpliceType"><span class="annot"><a href="GHC.Tc.Types.html#SpliceType"><span class="hs-identifier hs-var">SpliceType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Typed"><span class="annot"><a href="GHC.Tc.Types.html#Typed"><span class="hs-identifier hs-var">Typed</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="Untyped"><span class="annot"><a href="GHC.Tc.Types.html#Untyped"><span class="hs-identifier hs-var">Untyped</span></a></span></span><span>
</span><span id="line-928"></span><span>
</span><span id="line-929"></span><span class="hs-keyword">data</span><span> </span><span id="ThStage"><span class="annot"><a href="GHC.Tc.Types.html#ThStage"><span class="hs-identifier hs-var">ThStage</span></a></span></span><span>    </span><span class="hs-comment">-- See Note [Template Haskell state diagram]</span><span>
</span><span id="line-930"></span><span>                </span><span class="hs-comment">-- and Note [Template Haskell levels] in GHC.Tc.Gen.Splice</span><span>
</span><span id="line-931"></span><span>    </span><span class="hs-comment">-- Start at:   Comp</span><span>
</span><span id="line-932"></span><span>    </span><span class="hs-comment">-- At bracket: wrap current stage in Brack</span><span>
</span><span id="line-933"></span><span>    </span><span class="hs-comment">-- At splice:  currently Brack: return to previous stage</span><span>
</span><span id="line-934"></span><span>    </span><span class="hs-comment">--             currently Comp/Splice: compile and run</span><span>
</span><span id="line-935"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Splice"><span class="annot"><a href="GHC.Tc.Types.html#Splice"><span class="hs-identifier hs-var">Splice</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#SpliceType"><span class="hs-identifier hs-type">SpliceType</span></a></span><span> </span><span class="hs-comment">-- Inside a top-level splice</span><span>
</span><span id="line-936"></span><span>                      </span><span class="hs-comment">-- This code will be run *at compile time*;</span><span>
</span><span id="line-937"></span><span>                      </span><span class="hs-comment">--   the result replaces the splice</span><span>
</span><span id="line-938"></span><span>                      </span><span class="hs-comment">-- Binding level = 0</span><span>
</span><span id="line-939"></span><span>
</span><span id="line-940"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="RunSplice"><span class="annot"><a href="GHC.Tc.Types.html#RunSplice"><span class="hs-identifier hs-var">RunSplice</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-type">ForeignRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../template-haskell/src/Language.Haskell.TH.Syntax.html#Q"><span class="hs-identifier hs-type">TH.Q</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-941"></span><span>      </span><span class="hs-comment">-- Set when running a splice, i.e. NOT when renaming or typechecking the</span><span>
</span><span id="line-942"></span><span>      </span><span class="hs-comment">-- Haskell code for the splice. See Note [RunSplice ThLevel].</span><span>
</span><span id="line-943"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-944"></span><span>      </span><span class="hs-comment">-- Contains a list of mod finalizers collected while executing the splice.</span><span>
</span><span id="line-945"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-946"></span><span>      </span><span class="hs-comment">-- 'addModFinalizer' inserts finalizers here, and from here they are taken</span><span>
</span><span id="line-947"></span><span>      </span><span class="hs-comment">-- to construct an @HsSpliced@ annotation for untyped splices. See Note</span><span>
</span><span id="line-948"></span><span>      </span><span class="hs-comment">-- [Delaying modFinalizers in untyped splices] in GHC.Rename.Splice.</span><span>
</span><span id="line-949"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-950"></span><span>      </span><span class="hs-comment">-- For typed splices, the typechecker takes finalizers from here and</span><span>
</span><span id="line-951"></span><span>      </span><span class="hs-comment">-- inserts them in the list of finalizers in the global environment.</span><span>
</span><span id="line-952"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-953"></span><span>      </span><span class="hs-comment">-- See Note [Collecting modFinalizers in typed splices] in &quot;GHC.Tc.Gen.Splice&quot;.</span><span>
</span><span id="line-954"></span><span>
</span><span id="line-955"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Comp"><span class="annot"><a href="GHC.Tc.Types.html#Comp"><span class="hs-identifier hs-var">Comp</span></a></span></span><span>        </span><span class="hs-comment">-- Ordinary Haskell code</span><span>
</span><span id="line-956"></span><span>                </span><span class="hs-comment">-- Binding level = 1</span><span>
</span><span id="line-957"></span><span>
</span><span id="line-958"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Brack"><span class="annot"><a href="GHC.Tc.Types.html#Brack"><span class="hs-identifier hs-var">Brack</span></a></span></span><span>                       </span><span class="hs-comment">-- Inside brackets</span><span>
</span><span id="line-959"></span><span>      </span><span class="annot"><a href="GHC.Tc.Types.html#ThStage"><span class="hs-identifier hs-type">ThStage</span></a></span><span>                   </span><span class="hs-comment">--   Enclosing stage</span><span>
</span><span id="line-960"></span><span>      </span><span class="annot"><a href="GHC.Tc.Types.html#PendingStuff"><span class="hs-identifier hs-type">PendingStuff</span></a></span><span>
</span><span id="line-961"></span><span>
</span><span id="line-962"></span><span class="hs-keyword">data</span><span> </span><span id="PendingStuff"><span class="annot"><a href="GHC.Tc.Types.html#PendingStuff"><span class="hs-identifier hs-var">PendingStuff</span></a></span></span><span>
</span><span id="line-963"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="RnPendingUntyped"><span class="annot"><a href="GHC.Tc.Types.html#RnPendingUntyped"><span class="hs-identifier hs-var">RnPendingUntyped</span></a></span></span><span>              </span><span class="hs-comment">-- Renaming the inside of an *untyped* bracket</span><span>
</span><span id="line-964"></span><span>      </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Expr.html#PendingRnSplice"><span class="hs-identifier hs-type">PendingRnSplice</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>   </span><span class="hs-comment">-- Pending splices in here</span><span>
</span><span id="line-965"></span><span>
</span><span id="line-966"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="RnPendingTyped"><span class="annot"><a href="GHC.Tc.Types.html#RnPendingTyped"><span class="hs-identifier hs-var">RnPendingTyped</span></a></span></span><span>                </span><span class="hs-comment">-- Renaming the inside of a *typed* bracket</span><span>
</span><span id="line-967"></span><span>
</span><span id="line-968"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="TcPending"><span class="annot"><a href="GHC.Tc.Types.html#TcPending"><span class="hs-identifier hs-var">TcPending</span></a></span></span><span>                     </span><span class="hs-comment">-- Typechecking the inside of a typed bracket</span><span>
</span><span id="line-969"></span><span>      </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Expr.html#PendingTcSplice"><span class="hs-identifier hs-type">PendingTcSplice</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>   </span><span class="hs-comment">--   Accumulate pending splices here</span><span>
</span><span id="line-970"></span><span>      </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span class="hs-special">)</span><span>   </span><span class="hs-comment">--     and type constraints here</span><span>
</span><span id="line-971"></span><span>      </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#QuoteWrapper"><span class="hs-identifier hs-type">QuoteWrapper</span></a></span><span>                </span><span class="hs-comment">-- A type variable and evidence variable</span><span>
</span><span id="line-972"></span><span>                                  </span><span class="hs-comment">-- for the overall monad of</span><span>
</span><span id="line-973"></span><span>                                  </span><span class="hs-comment">-- the bracket. Splices are checked</span><span>
</span><span id="line-974"></span><span>                                  </span><span class="hs-comment">-- against this monad. The evidence</span><span>
</span><span id="line-975"></span><span>                                  </span><span class="hs-comment">-- variable is used for desugaring</span><span>
</span><span id="line-976"></span><span>                                  </span><span class="hs-comment">-- `lift`.</span><span>
</span><span id="line-977"></span><span>
</span><span id="line-978"></span><span>
</span><span id="line-979"></span><span class="annot"><a href="GHC.Tc.Types.html#topStage"><span class="hs-identifier hs-type">topStage</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#topAnnStage"><span class="hs-identifier hs-type">topAnnStage</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#topSpliceStage"><span class="hs-identifier hs-type">topSpliceStage</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ThStage"><span class="hs-identifier hs-type">ThStage</span></a></span><span>
</span><span id="line-980"></span><span id="topStage"><span class="annot"><span class="annottext">topStage :: ThStage
</span><a href="GHC.Tc.Types.html#topStage"><span class="hs-identifier hs-var hs-var">topStage</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThStage
</span><a href="GHC.Tc.Types.html#Comp"><span class="hs-identifier hs-var">Comp</span></a></span><span>
</span><span id="line-981"></span><span id="topAnnStage"><span class="annot"><span class="annottext">topAnnStage :: ThStage
</span><a href="GHC.Tc.Types.html#topAnnStage"><span class="hs-identifier hs-var hs-var">topAnnStage</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SpliceType -&gt; ThStage
</span><a href="GHC.Tc.Types.html#Splice"><span class="hs-identifier hs-var">Splice</span></a></span><span> </span><span class="annot"><span class="annottext">SpliceType
</span><a href="GHC.Tc.Types.html#Untyped"><span class="hs-identifier hs-var">Untyped</span></a></span><span>
</span><span id="line-982"></span><span id="topSpliceStage"><span class="annot"><span class="annottext">topSpliceStage :: ThStage
</span><a href="GHC.Tc.Types.html#topSpliceStage"><span class="hs-identifier hs-var hs-var">topSpliceStage</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SpliceType -&gt; ThStage
</span><a href="GHC.Tc.Types.html#Splice"><span class="hs-identifier hs-var">Splice</span></a></span><span> </span><span class="annot"><span class="annottext">SpliceType
</span><a href="GHC.Tc.Types.html#Untyped"><span class="hs-identifier hs-var">Untyped</span></a></span><span>
</span><span id="line-983"></span><span>
</span><span id="line-984"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879729"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ThStage"><span class="hs-identifier hs-type">ThStage</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-985"></span><span>   </span><span id="local-6989586621680879727"><span class="annot"><span class="annottext">ppr :: ThStage -&gt; SDoc
</span><a href="#local-6989586621680879727"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#Splice"><span class="hs-identifier hs-type">Splice</span></a></span><span> </span><span class="annot"><span class="annottext">SpliceType
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;Splice&quot;</span></span><span>
</span><span id="line-986"></span><span>   </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#RunSplice"><span class="hs-identifier hs-type">RunSplice</span></a></span><span> </span><span class="annot"><span class="annottext">TcRef [ForeignRef (Q ())]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;RunSplice&quot;</span></span><span>
</span><span id="line-987"></span><span>   </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ThStage
</span><a href="GHC.Tc.Types.html#Comp"><span class="hs-identifier hs-var">Comp</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;Comp&quot;</span></span><span>
</span><span id="line-988"></span><span>   </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#Brack"><span class="hs-identifier hs-type">Brack</span></a></span><span> </span><span id="local-6989586621680879725"><span class="annot"><span class="annottext">ThStage
</span><a href="#local-6989586621680879725"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="annot"><span class="annottext">PendingStuff
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;Brack&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ThStage -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ThStage
</span><a href="#local-6989586621680879725"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-989"></span><span>
</span><span id="line-990"></span><span class="hs-keyword">type</span><span> </span><span id="ThLevel"><span class="annot"><a href="GHC.Tc.Types.html#ThLevel"><span class="hs-identifier hs-var">ThLevel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-991"></span><span>    </span><span class="hs-comment">-- NB: see Note [Template Haskell levels] in GHC.Tc.Gen.Splice</span><span>
</span><span id="line-992"></span><span>    </span><span class="hs-comment">-- Incremented when going inside a bracket,</span><span>
</span><span id="line-993"></span><span>    </span><span class="hs-comment">-- decremented when going inside a splice</span><span>
</span><span id="line-994"></span><span>    </span><span class="hs-comment">-- NB: ThLevel is one greater than the 'n' in Fig 2 of the</span><span>
</span><span id="line-995"></span><span>    </span><span class="hs-comment">--     original &quot;Template meta-programming for Haskell&quot; paper</span><span>
</span><span id="line-996"></span><span>
</span><span id="line-997"></span><span class="annot"><a href="GHC.Tc.Types.html#impLevel"><span class="hs-identifier hs-type">impLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#outerLevel"><span class="hs-identifier hs-type">outerLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ThLevel"><span class="hs-identifier hs-type">ThLevel</span></a></span><span>
</span><span id="line-998"></span><span id="impLevel"><span class="annot"><span class="annottext">impLevel :: ThLevel
</span><a href="GHC.Tc.Types.html#impLevel"><span class="hs-identifier hs-var hs-var">impLevel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThLevel
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-comment">-- Imported things; they can be used inside a top level splice</span><span>
</span><span id="line-999"></span><span id="outerLevel"><span class="annot"><span class="annottext">outerLevel :: ThLevel
</span><a href="GHC.Tc.Types.html#outerLevel"><span class="hs-identifier hs-var hs-var">outerLevel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThLevel
</span><span class="hs-number">1</span></span><span>  </span><span class="hs-comment">-- Things defined outside brackets</span><span>
</span><span id="line-1000"></span><span>
</span><span id="line-1001"></span><span class="annot"><a href="GHC.Tc.Types.html#thLevel"><span class="hs-identifier hs-type">thLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ThStage"><span class="hs-identifier hs-type">ThStage</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ThLevel"><span class="hs-identifier hs-type">ThLevel</span></a></span><span>
</span><span id="line-1002"></span><span id="thLevel"><span class="annot"><span class="annottext">thLevel :: ThStage -&gt; ThLevel
</span><a href="GHC.Tc.Types.html#thLevel"><span class="hs-identifier hs-var hs-var">thLevel</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#Splice"><span class="hs-identifier hs-type">Splice</span></a></span><span> </span><span class="annot"><span class="annottext">SpliceType
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThLevel
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1003"></span><span class="annot"><a href="GHC.Tc.Types.html#thLevel"><span class="hs-identifier hs-var">thLevel</span></a></span><span> </span><span class="annot"><span class="annottext">ThStage
</span><a href="GHC.Tc.Types.html#Comp"><span class="hs-identifier hs-var">Comp</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThLevel
</span><span class="hs-number">1</span></span><span>
</span><span id="line-1004"></span><span class="annot"><a href="GHC.Tc.Types.html#thLevel"><span class="hs-identifier hs-var">thLevel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#Brack"><span class="hs-identifier hs-type">Brack</span></a></span><span> </span><span id="local-6989586621680879723"><span class="annot"><span class="annottext">ThStage
</span><a href="#local-6989586621680879723"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="annot"><span class="annottext">PendingStuff
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThStage -&gt; ThLevel
</span><a href="GHC.Tc.Types.html#thLevel"><span class="hs-identifier hs-var">thLevel</span></a></span><span> </span><span class="annot"><span class="annottext">ThStage
</span><a href="#local-6989586621680879723"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">ThLevel -&gt; ThLevel -&gt; ThLevel
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">ThLevel
</span><span class="hs-number">1</span></span><span>
</span><span id="line-1005"></span><span class="annot"><a href="GHC.Tc.Types.html#thLevel"><span class="hs-identifier hs-var">thLevel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#RunSplice"><span class="hs-identifier hs-type">RunSplice</span></a></span><span> </span><span class="annot"><span class="annottext">TcRef [ForeignRef (Q ())]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; ThLevel
forall a. FilePath -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;thLevel: called when running a splice&quot;</span></span><span>
</span><span id="line-1006"></span><span>                        </span><span class="hs-comment">-- See Note [RunSplice ThLevel].</span><span>
</span><span id="line-1007"></span><span>
</span><span id="line-1008"></span><span class="hs-comment">{- Node [RunSplice ThLevel]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'RunSplice' stage is set when executing a splice, and only when running a
splice. In particular it is not set when the splice is renamed or typechecked.

'RunSplice' is needed to provide a reference where 'addModFinalizer' can insert
the finalizer (see Note [Delaying modFinalizers in untyped splices]), and
'addModFinalizer' runs when doing Q things. Therefore, It doesn't make sense to
set 'RunSplice' when renaming or typechecking the splice, where 'Splice',
'Brack' or 'Comp' are used instead.

-}</span><span>
</span><span id="line-1020"></span><span>
</span><span id="line-1021"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-1022"></span><span class="hs-comment">-- Arrow-notation context</span><span>
</span><span id="line-1023"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-1024"></span><span>
</span><span id="line-1025"></span><span class="hs-comment">{- Note [Escaping the arrow scope]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In arrow notation, a variable bound by a proc (or enclosed let/kappa)
is not in scope to the left of an arrow tail (-&lt;) or the head of (|..|).
For example

        proc x -&gt; (e1 -&lt; e2)

Here, x is not in scope in e1, but it is in scope in e2.  This can get
a bit complicated:

        let x = 3 in
        proc y -&gt; (proc z -&gt; e1) -&lt; e2

Here, x and z are in scope in e1, but y is not.

We implement this by
recording the environment when passing a proc (using newArrowScope),
and returning to that (using escapeArrowScope) on the left of -&lt; and the
head of (|..|).

All this can be dealt with by the *renamer*. But the type checker needs
to be involved too.  Example (arrowfail001)
  class Foo a where foo :: a -&gt; ()
  data Bar = forall a. Foo a =&gt; Bar a
  get :: Bar -&gt; ()
  get = proc x -&gt; case x of Bar a -&gt; foo -&lt; a
Here the call of 'foo' gives rise to a (Foo a) constraint that should not
be captured by the pattern match on 'Bar'.  Rather it should join the
constraints from further out.  So we must capture the constraint bag
from further out in the ArrowCtxt that we push inwards.
-}</span><span>
</span><span id="line-1057"></span><span>
</span><span id="line-1058"></span><span class="hs-keyword">data</span><span> </span><span id="ArrowCtxt"><span class="annot"><a href="GHC.Tc.Types.html#ArrowCtxt"><span class="hs-identifier hs-var">ArrowCtxt</span></a></span></span><span>   </span><span class="hs-comment">-- Note [Escaping the arrow scope]</span><span>
</span><span id="line-1059"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="NoArrowCtxt"><span class="annot"><a href="GHC.Tc.Types.html#NoArrowCtxt"><span class="hs-identifier hs-var">NoArrowCtxt</span></a></span></span><span>
</span><span id="line-1060"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ArrowCtxt"><span class="annot"><a href="GHC.Tc.Types.html#ArrowCtxt"><span class="hs-identifier hs-var">ArrowCtxt</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#LocalRdrEnv"><span class="hs-identifier hs-type">LocalRdrEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcRef"><span class="hs-identifier hs-type">TcRef</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1061"></span><span>
</span><span id="line-1062"></span><span>
</span><span id="line-1063"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-1064"></span><span class="hs-comment">-- TcTyThing</span><span>
</span><span id="line-1065"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-1066"></span><span>
</span><span id="line-1067"></span><span class="hs-comment">-- | A typecheckable thing available in a local context.  Could be</span><span>
</span><span id="line-1068"></span><span class="hs-comment">-- 'AGlobal' 'TyThing', but also lexically scoped variables, etc.</span><span>
</span><span id="line-1069"></span><span class="hs-comment">-- See &quot;GHC.Tc.Utils.Env&quot; for how to retrieve a 'TyThing' given a 'Name'.</span><span>
</span><span id="line-1070"></span><span class="hs-keyword">data</span><span> </span><span id="TcTyThing"><span class="annot"><a href="GHC.Tc.Types.html#TcTyThing"><span class="hs-identifier hs-var">TcTyThing</span></a></span></span><span>
</span><span id="line-1071"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="AGlobal"><span class="annot"><a href="GHC.Tc.Types.html#AGlobal"><span class="hs-identifier hs-var">AGlobal</span></a></span></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier hs-type">TyThing</span></a></span><span>             </span><span class="hs-comment">-- Used only in the return type of a lookup</span><span>
</span><span id="line-1072"></span><span>
</span><span id="line-1073"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ATcId"><span class="annot"><a href="GHC.Tc.Types.html#ATcId"><span class="hs-identifier hs-var">ATcId</span></a></span></span><span>           </span><span class="hs-comment">-- Ids defined in this module; may not be fully zonked</span><span>
</span><span id="line-1074"></span><span>      </span><span class="hs-special">{</span><span> </span><span id="tct_id"><span class="annot"><span class="annottext">TcTyThing -&gt; TyVar
</span><a href="GHC.Tc.Types.html#tct_id"><span class="hs-identifier hs-var hs-var">tct_id</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span>
</span><span id="line-1075"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="tct_info"><span class="annot"><span class="annottext">TcTyThing -&gt; IdBindingInfo
</span><a href="GHC.Tc.Types.html#tct_info"><span class="hs-identifier hs-var hs-var">tct_info</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IdBindingInfo"><span class="hs-identifier hs-type">IdBindingInfo</span></a></span><span>   </span><span class="hs-comment">-- See Note [Meaning of IdBindingInfo]</span><span>
</span><span id="line-1076"></span><span>      </span><span class="hs-special">}</span><span>
</span><span id="line-1077"></span><span>
</span><span id="line-1078"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ATyVar"><span class="annot"><a href="GHC.Tc.Types.html#ATyVar"><span class="hs-identifier hs-var">ATyVar</span></a></span></span><span>  </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span>   </span><span class="hs-comment">-- See Note [Type variables in the type environment]</span><span>
</span><span id="line-1079"></span><span>
</span><span id="line-1080"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ATcTyCon"><span class="annot"><a href="GHC.Tc.Types.html#ATcTyCon"><span class="hs-identifier hs-var">ATcTyCon</span></a></span></span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>   </span><span class="hs-comment">-- Used temporarily, during kind checking, for the</span><span>
</span><span id="line-1081"></span><span>                     </span><span class="hs-comment">-- tycons and clases in this recursive group</span><span>
</span><span id="line-1082"></span><span>                     </span><span class="hs-comment">-- The TyCon is always a TcTyCon.  Its kind</span><span>
</span><span id="line-1083"></span><span>                     </span><span class="hs-comment">-- can be a mono-kind or a poly-kind; in TcTyClsDcls see</span><span>
</span><span id="line-1084"></span><span>                     </span><span class="hs-comment">-- Note [Type checking recursive type and class declarations]</span><span>
</span><span id="line-1085"></span><span>
</span><span id="line-1086"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="APromotionErr"><span class="annot"><a href="GHC.Tc.Types.html#APromotionErr"><span class="hs-identifier hs-var">APromotionErr</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#PromotionErr"><span class="hs-identifier hs-type">PromotionErr</span></a></span><span>
</span><span id="line-1087"></span><span>
</span><span id="line-1088"></span><span class="hs-keyword">data</span><span> </span><span id="PromotionErr"><span class="annot"><a href="GHC.Tc.Types.html#PromotionErr"><span class="hs-identifier hs-var">PromotionErr</span></a></span></span><span>
</span><span id="line-1089"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="TyConPE"><span class="annot"><a href="GHC.Tc.Types.html#TyConPE"><span class="hs-identifier hs-var">TyConPE</span></a></span></span><span>          </span><span class="hs-comment">-- TyCon used in a kind before we are ready</span><span>
</span><span id="line-1090"></span><span>                     </span><span class="hs-comment">--     data T :: T -&gt; * where ...</span><span>
</span><span id="line-1091"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ClassPE"><span class="annot"><a href="GHC.Tc.Types.html#ClassPE"><span class="hs-identifier hs-var">ClassPE</span></a></span></span><span>          </span><span class="hs-comment">-- Ditto Class</span><span>
</span><span id="line-1092"></span><span>
</span><span id="line-1093"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FamDataConPE"><span class="annot"><a href="GHC.Tc.Types.html#FamDataConPE"><span class="hs-identifier hs-var">FamDataConPE</span></a></span></span><span>     </span><span class="hs-comment">-- Data constructor for a data family</span><span>
</span><span id="line-1094"></span><span>                     </span><span class="hs-comment">-- See Note [AFamDataCon: not promoting data family constructors]</span><span>
</span><span id="line-1095"></span><span>                     </span><span class="hs-comment">-- in GHC.Tc.Utils.Env.</span><span>
</span><span id="line-1096"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ConstrainedDataConPE"><span class="annot"><a href="GHC.Tc.Types.html#ConstrainedDataConPE"><span class="hs-identifier hs-var">ConstrainedDataConPE</span></a></span></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span>
</span><span id="line-1097"></span><span>                     </span><span class="hs-comment">-- Data constructor with a non-equality context</span><span>
</span><span id="line-1098"></span><span>                     </span><span class="hs-comment">-- See Note [Don't promote data constructors with</span><span>
</span><span id="line-1099"></span><span>                     </span><span class="hs-comment">--           non-equality contexts] in GHC.Tc.Gen.HsType</span><span>
</span><span id="line-1100"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="PatSynPE"><span class="annot"><a href="GHC.Tc.Types.html#PatSynPE"><span class="hs-identifier hs-var">PatSynPE</span></a></span></span><span>         </span><span class="hs-comment">-- Pattern synonyms</span><span>
</span><span id="line-1101"></span><span>                     </span><span class="hs-comment">-- See Note [Don't promote pattern synonyms] in GHC.Tc.Utils.Env</span><span>
</span><span id="line-1102"></span><span>
</span><span id="line-1103"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="RecDataConPE"><span class="annot"><a href="GHC.Tc.Types.html#RecDataConPE"><span class="hs-identifier hs-var">RecDataConPE</span></a></span></span><span>     </span><span class="hs-comment">-- Data constructor in a recursive loop</span><span>
</span><span id="line-1104"></span><span>                     </span><span class="hs-comment">-- See Note [Recursion and promoting data constructors] in GHC.Tc.TyCl</span><span>
</span><span id="line-1105"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="NoDataKindsTC"><span class="annot"><a href="GHC.Tc.Types.html#NoDataKindsTC"><span class="hs-identifier hs-var">NoDataKindsTC</span></a></span></span><span>    </span><span class="hs-comment">-- -XDataKinds not enabled (for a tycon)</span><span>
</span><span id="line-1106"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="NoDataKindsDC"><span class="annot"><a href="GHC.Tc.Types.html#NoDataKindsDC"><span class="hs-identifier hs-var">NoDataKindsDC</span></a></span></span><span>    </span><span class="hs-comment">-- -XDataKinds not enabled (for a datacon)</span><span>
</span><span id="line-1107"></span><span>
</span><span id="line-1108"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879699"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcTyThing"><span class="hs-identifier hs-type">TcTyThing</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>     </span><span class="hs-comment">-- Debugging only</span><span>
</span><span id="line-1109"></span><span>   </span><span id="local-6989586621680879685"><span class="annot"><span class="annottext">ppr :: TcTyThing -&gt; SDoc
</span><a href="#local-6989586621680879685"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#AGlobal"><span class="hs-identifier hs-type">AGlobal</span></a></span><span> </span><span id="local-6989586621680879684"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621680879684"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyThing -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621680879684"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-1110"></span><span>   </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span id="local-6989586621680879683"><span class="annot"><span class="annottext">elt :: TcTyThing
</span><a href="#local-6989586621680879683"><span class="hs-identifier hs-var">elt</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#ATcId"><span class="hs-identifier hs-type">ATcId</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;Identifier&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span>
</span><span id="line-1111"></span><span>                          </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#brackets"><span class="hs-identifier hs-var">brackets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyThing -&gt; TyVar
</span><a href="GHC.Tc.Types.html#tct_id"><span class="hs-identifier hs-var hs-var">tct_id</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyThing
</span><a href="#local-6989586621680879683"><span class="hs-identifier hs-var">elt</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span>
</span><span id="line-1112"></span><span>                                 </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar -&gt; Type
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyThing -&gt; TyVar
</span><a href="GHC.Tc.Types.html#tct_id"><span class="hs-identifier hs-var hs-var">tct_id</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyThing
</span><a href="#local-6989586621680879683"><span class="hs-identifier hs-var">elt</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#comma"><span class="hs-identifier hs-var">comma</span></a></span><span>
</span><span id="line-1113"></span><span>                                 </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">IdBindingInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyThing -&gt; IdBindingInfo
</span><a href="GHC.Tc.Types.html#tct_info"><span class="hs-identifier hs-var hs-var">tct_info</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyThing
</span><a href="#local-6989586621680879683"><span class="hs-identifier hs-var">elt</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1114"></span><span>   </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#ATyVar"><span class="hs-identifier hs-type">ATyVar</span></a></span><span> </span><span id="local-6989586621680879679"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879679"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680879678"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879678"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;Type variable&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879679"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#equals"><span class="hs-identifier hs-var">equals</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879678"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-1115"></span><span>                            </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar -&gt; Type
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879678"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1116"></span><span>   </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#ATcTyCon"><span class="hs-identifier hs-type">ATcTyCon</span></a></span><span> </span><span id="local-6989586621680879675"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680879675"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;ATcTyCon&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680879675"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCon.html#tyConKind"><span class="hs-identifier hs-var hs-var">tyConKind</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680879675"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1117"></span><span>   </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#APromotionErr"><span class="hs-identifier hs-type">APromotionErr</span></a></span><span> </span><span id="local-6989586621680879674"><span class="annot"><span class="annottext">PromotionErr
</span><a href="#local-6989586621680879674"><span class="hs-identifier hs-var">err</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;APromotionErr&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="#local-6989586621680879674"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-1118"></span><span>
</span><span id="line-1119"></span><span class="hs-comment">-- | IdBindingInfo describes how an Id is bound.</span><span>
</span><span id="line-1120"></span><span class="hs-comment">--</span><span>
</span><span id="line-1121"></span><span class="hs-comment">-- It is used for the following purposes:</span><span>
</span><span id="line-1122"></span><span class="hs-comment">-- a) for static forms in 'GHC.Tc.Gen.Expr.checkClosedInStaticForm' and</span><span>
</span><span id="line-1123"></span><span class="hs-comment">-- b) to figure out when a nested binding can be generalised,</span><span>
</span><span id="line-1124"></span><span class="hs-comment">--    in 'GHC.Tc.Gen.Bind.decideGeneralisationPlan'.</span><span>
</span><span id="line-1125"></span><span class="hs-comment">--</span><span>
</span><span id="line-1126"></span><span class="hs-keyword">data</span><span> </span><span id="IdBindingInfo"><span class="annot"><a href="GHC.Tc.Types.html#IdBindingInfo"><span class="hs-identifier hs-var">IdBindingInfo</span></a></span></span><span> </span><span class="hs-comment">-- See Note [Meaning of IdBindingInfo and ClosedTypeId]</span><span>
</span><span id="line-1127"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span id="NotLetBound"><span class="annot"><a href="GHC.Tc.Types.html#NotLetBound"><span class="hs-identifier hs-var">NotLetBound</span></a></span></span><span>
</span><span id="line-1128"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span id="ClosedLet"><span class="annot"><a href="GHC.Tc.Types.html#ClosedLet"><span class="hs-identifier hs-var">ClosedLet</span></a></span></span><span>
</span><span id="line-1129"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span id="NonClosedLet"><span class="annot"><a href="GHC.Tc.Types.html#NonClosedLet"><span class="hs-identifier hs-var">NonClosedLet</span></a></span></span><span>
</span><span id="line-1130"></span><span>         </span><span class="annot"><a href="GHC.Tc.Types.html#RhsNames"><span class="hs-identifier hs-type">RhsNames</span></a></span><span>        </span><span class="hs-comment">-- Used for (static e) checks only</span><span>
</span><span id="line-1131"></span><span>         </span><span class="annot"><a href="GHC.Tc.Types.html#ClosedTypeId"><span class="hs-identifier hs-type">ClosedTypeId</span></a></span><span>    </span><span class="hs-comment">-- Used for generalisation checks</span><span>
</span><span id="line-1132"></span><span>                         </span><span class="hs-comment">-- and for (static e) checks</span><span>
</span><span id="line-1133"></span><span>
</span><span id="line-1134"></span><span class="hs-comment">-- | IsGroupClosed describes a group of mutually-recursive bindings</span><span>
</span><span id="line-1135"></span><span class="hs-keyword">data</span><span> </span><span id="IsGroupClosed"><span class="annot"><a href="GHC.Tc.Types.html#IsGroupClosed"><span class="hs-identifier hs-var">IsGroupClosed</span></a></span></span><span>
</span><span id="line-1136"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="IsGroupClosed"><span class="annot"><a href="GHC.Tc.Types.html#IsGroupClosed"><span class="hs-identifier hs-var">IsGroupClosed</span></a></span></span><span>
</span><span id="line-1137"></span><span>      </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RhsNames"><span class="hs-identifier hs-type">RhsNames</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- Free var info for the RHS of each binding in the goup</span><span>
</span><span id="line-1138"></span><span>                          </span><span class="hs-comment">-- Used only for (static e) checks</span><span>
</span><span id="line-1139"></span><span>
</span><span id="line-1140"></span><span>      </span><span class="annot"><a href="GHC.Tc.Types.html#ClosedTypeId"><span class="hs-identifier hs-type">ClosedTypeId</span></a></span><span>        </span><span class="hs-comment">-- True &lt;=&gt; all the free vars of the group are</span><span>
</span><span id="line-1141"></span><span>                          </span><span class="hs-comment">--          imported or ClosedLet or</span><span>
</span><span id="line-1142"></span><span>                          </span><span class="hs-comment">--          NonClosedLet with ClosedTypeId=True.</span><span>
</span><span id="line-1143"></span><span>                          </span><span class="hs-comment">--          In particular, no tyvars, no NotLetBound</span><span>
</span><span id="line-1144"></span><span>
</span><span id="line-1145"></span><span class="hs-keyword">type</span><span> </span><span id="RhsNames"><span class="annot"><a href="GHC.Tc.Types.html#RhsNames"><span class="hs-identifier hs-var">RhsNames</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span>   </span><span class="hs-comment">-- Names of variables, mentioned on the RHS of</span><span>
</span><span id="line-1146"></span><span>                          </span><span class="hs-comment">-- a definition, that are not Global or ClosedLet</span><span>
</span><span id="line-1147"></span><span>
</span><span id="line-1148"></span><span class="hs-keyword">type</span><span> </span><span id="ClosedTypeId"><span class="annot"><a href="GHC.Tc.Types.html#ClosedTypeId"><span class="hs-identifier hs-var">ClosedTypeId</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1149"></span><span>  </span><span class="hs-comment">-- See Note [Meaning of IdBindingInfo and ClosedTypeId]</span><span>
</span><span id="line-1150"></span><span>
</span><span id="line-1151"></span><span class="hs-comment">{- Note [Meaning of IdBindingInfo]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NotLetBound means that
  the Id is not let-bound (e.g. it is bound in a
  lambda-abstraction or in a case pattern)

ClosedLet means that
   - The Id is let-bound,
   - Any free term variables are also Global or ClosedLet
   - Its type has no free variables (NB: a top-level binding subject
     to the MR might have free vars in its type)
   These ClosedLets can definitely be floated to top level; and we
   may need to do so for static forms.

   Property:   ClosedLet
             is equivalent to
               NonClosedLet emptyNameSet True

(NonClosedLet (fvs::RhsNames) (cl::ClosedTypeId)) means that
   - The Id is let-bound

   - The fvs::RhsNames contains the free names of the RHS,
     excluding Global and ClosedLet ones.

   - For the ClosedTypeId field see Note [Bindings with closed types]

For (static e) to be valid, we need for every 'x' free in 'e',
that x's binding is floatable to the top level.  Specifically:
   * x's RhsNames must be empty
   * x's type has no free variables
See Note [Grand plan for static forms] in &quot;GHC.Iface.Tidy.StaticPtrTable&quot;.
This test is made in GHC.Tc.Gen.Expr.checkClosedInStaticForm.
Actually knowing x's RhsNames (rather than just its emptiness
or otherwise) is just so we can produce better error messages

Note [Bindings with closed types: ClosedTypeId]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider

  f x = let g ys = map not ys
        in ...

Can we generalise 'g' under the OutsideIn algorithm?  Yes,
because all g's free variables are top-level; that is they themselves
have no free type variables, and it is the type variables in the
environment that makes things tricky for OutsideIn generalisation.

Here's the invariant:
   If an Id has ClosedTypeId=True (in its IdBindingInfo), then
   the Id's type is /definitely/ closed (has no free type variables).
   Specifically,
       a) The Id's actual type is closed (has no free tyvars)
       b) Either the Id has a (closed) user-supplied type signature
          or all its free variables are Global/ClosedLet
             or NonClosedLet with ClosedTypeId=True.
          In particular, none are NotLetBound.

Why is (b) needed?   Consider
    \x. (x :: Int, let y = x+1 in ...)
Initially x::alpha.  If we happen to typecheck the 'let' before the
(x::Int), y's type will have a free tyvar; but if the other way round
it won't.  So we treat any let-bound variable with a free
non-let-bound variable as not ClosedTypeId, regardless of what the
free vars of its type actually are.

But if it has a signature, all is well:
   \x. ...(let { y::Int; y = x+1 } in
           let { v = y+2 } in ...)...
Here the signature on 'v' makes 'y' a ClosedTypeId, so we can
generalise 'v'.

Note that:

  * A top-level binding may not have ClosedTypeId=True, if it suffers
    from the MR

  * A nested binding may be closed (eg 'g' in the example we started
    with). Indeed, that's the point; whether a function is defined at
    top level or nested is orthogonal to the question of whether or
    not it is closed.

  * A binding may be non-closed because it mentions a lexically scoped
    *type variable*  Eg
        f :: forall a. blah
        f x = let g y = ...(y::a)...

Under OutsideIn we are free to generalise an Id all of whose free
variables have ClosedTypeId=True (or imported).  This is an extension
compared to the JFP paper on OutsideIn, which used &quot;top-level&quot; as a
proxy for &quot;closed&quot;.  (It's not a good proxy anyway -- the MR can make
a top-level binding with a free type variable.)

Note [Type variables in the type environment]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The type environment has a binding for each lexically-scoped
type variable that is in scope.  For example

  f :: forall a. a -&gt; a
  f x = (x :: a)

  g1 :: [a] -&gt; a
  g1 (ys :: [b]) = head ys :: b

  g2 :: [Int] -&gt; Int
  g2 (ys :: [c]) = head ys :: c

* The forall'd variable 'a' in the signature scopes over f's RHS.

* The pattern-bound type variable 'b' in 'g1' scopes over g1's
  RHS; note that it is bound to a skolem 'a' which is not itself
  lexically in scope.

* The pattern-bound type variable 'c' in 'g2' is bound to
  Int; that is, pattern-bound type variables can stand for
  arbitrary types. (see
    GHC proposal #128 &quot;Allow ScopedTypeVariables to refer to types&quot;
    https://github.com/ghc-proposals/ghc-proposals/pull/128,
  and the paper
    &quot;Type variables in patterns&quot;, Haskell Symposium 2018.


This is implemented by the constructor
   ATyVar Name TcTyVar
in the type environment.

* The Name is the name of the original, lexically scoped type
  variable

* The TcTyVar is sometimes a skolem (like in 'f'), and sometimes
  a unification variable (like in 'g1', 'g2').  We never zonk the
  type environment so in the latter case it always stays as a
  unification variable, although that variable may be later
  unified with a type (such as Int in 'g2').
-}</span><span>
</span><span id="line-1285"></span><span>
</span><span id="line-1286"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879667"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IdBindingInfo"><span class="hs-identifier hs-type">IdBindingInfo</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1287"></span><span>  </span><span id="local-6989586621680879661"><span class="annot"><span class="annottext">ppr :: IdBindingInfo -&gt; SDoc
</span><a href="#local-6989586621680879661"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">IdBindingInfo
</span><a href="GHC.Tc.Types.html#NotLetBound"><span class="hs-identifier hs-var">NotLetBound</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;NotLetBound&quot;</span></span><span>
</span><span id="line-1288"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">IdBindingInfo
</span><a href="GHC.Tc.Types.html#ClosedLet"><span class="hs-identifier hs-var">ClosedLet</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;TopLevelLet&quot;</span></span><span>
</span><span id="line-1289"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#NonClosedLet"><span class="hs-identifier hs-type">NonClosedLet</span></a></span><span> </span><span id="local-6989586621680879660"><span class="annot"><span class="annottext">NameSet
</span><a href="#local-6989586621680879660"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span id="local-6989586621680879659"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680879659"><span class="hs-identifier hs-var">closed_type</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1290"></span><span>    </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;TopLevelLet&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">NameSet -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">NameSet
</span><a href="#local-6989586621680879660"><span class="hs-identifier hs-var">fvs</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680879659"><span class="hs-identifier hs-var">closed_type</span></a></span><span>
</span><span id="line-1291"></span><span>
</span><span id="line-1292"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879656"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#PromotionErr"><span class="hs-identifier hs-type">PromotionErr</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1293"></span><span>  </span><span id="local-6989586621680879654"><span class="annot"><span class="annottext">ppr :: PromotionErr -&gt; SDoc
</span><a href="#local-6989586621680879654"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#ClassPE"><span class="hs-identifier hs-var">ClassPE</span></a></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;ClassPE&quot;</span></span><span>
</span><span id="line-1294"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#TyConPE"><span class="hs-identifier hs-var">TyConPE</span></a></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;TyConPE&quot;</span></span><span>
</span><span id="line-1295"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#PatSynPE"><span class="hs-identifier hs-var">PatSynPE</span></a></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;PatSynPE&quot;</span></span><span>
</span><span id="line-1296"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#FamDataConPE"><span class="hs-identifier hs-var">FamDataConPE</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;FamDataConPE&quot;</span></span><span>
</span><span id="line-1297"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#ConstrainedDataConPE"><span class="hs-identifier hs-type">ConstrainedDataConPE</span></a></span><span> </span><span id="local-6989586621680879653"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680879653"><span class="hs-identifier hs-var">pred</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;ConstrainedDataConPE&quot;</span></span><span>
</span><span id="line-1298"></span><span>                                      </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680879653"><span class="hs-identifier hs-var">pred</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1299"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#RecDataConPE"><span class="hs-identifier hs-var">RecDataConPE</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;RecDataConPE&quot;</span></span><span>
</span><span id="line-1300"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#NoDataKindsTC"><span class="hs-identifier hs-var">NoDataKindsTC</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;NoDataKindsTC&quot;</span></span><span>
</span><span id="line-1301"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#NoDataKindsDC"><span class="hs-identifier hs-var">NoDataKindsDC</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;NoDataKindsDC&quot;</span></span><span>
</span><span id="line-1302"></span><span>
</span><span id="line-1303"></span><span class="hs-comment">--------------</span><span>
</span><span id="line-1304"></span><span class="annot"><a href="GHC.Tc.Types.html#pprTcTyThingCategory"><span class="hs-identifier hs-type">pprTcTyThingCategory</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcTyThing"><span class="hs-identifier hs-type">TcTyThing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1305"></span><span id="pprTcTyThingCategory"><span class="annot"><span class="annottext">pprTcTyThingCategory :: TcTyThing -&gt; SDoc
</span><a href="GHC.Tc.Types.html#pprTcTyThingCategory"><span class="hs-identifier hs-var hs-var">pprTcTyThingCategory</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">(FilePath -&gt; SDoc) -&gt; (TcTyThing -&gt; FilePath) -&gt; TcTyThing -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; FilePath
</span><a href="GHC.Utils.Misc.html#capitalise"><span class="hs-identifier hs-var">capitalise</span></a></span><span> </span><span class="annot"><span class="annottext">(FilePath -&gt; FilePath)
-&gt; (TcTyThing -&gt; FilePath) -&gt; TcTyThing -&gt; FilePath
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyThing -&gt; FilePath
</span><a href="GHC.Tc.Types.html#tcTyThingCategory"><span class="hs-identifier hs-var">tcTyThingCategory</span></a></span><span>
</span><span id="line-1306"></span><span>
</span><span id="line-1307"></span><span class="annot"><a href="GHC.Tc.Types.html#tcTyThingCategory"><span class="hs-identifier hs-type">tcTyThingCategory</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcTyThing"><span class="hs-identifier hs-type">TcTyThing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-1308"></span><span id="tcTyThingCategory"><span class="annot"><span class="annottext">tcTyThingCategory :: TcTyThing -&gt; FilePath
</span><a href="GHC.Tc.Types.html#tcTyThingCategory"><span class="hs-identifier hs-var hs-var">tcTyThingCategory</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#AGlobal"><span class="hs-identifier hs-type">AGlobal</span></a></span><span> </span><span id="local-6989586621680879650"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621680879650"><span class="hs-identifier hs-var">thing</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyThing -&gt; FilePath
</span><a href="GHC.Core.TyCo.Rep.html#tyThingCategory"><span class="hs-identifier hs-var">tyThingCategory</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621680879650"><span class="hs-identifier hs-var">thing</span></a></span><span>
</span><span id="line-1309"></span><span class="annot"><a href="GHC.Tc.Types.html#tcTyThingCategory"><span class="hs-identifier hs-var">tcTyThingCategory</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#ATyVar"><span class="hs-identifier hs-type">ATyVar</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;type variable&quot;</span></span><span>
</span><span id="line-1310"></span><span class="annot"><a href="GHC.Tc.Types.html#tcTyThingCategory"><span class="hs-identifier hs-var">tcTyThingCategory</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#ATcId"><span class="hs-identifier hs-type">ATcId</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;local identifier&quot;</span></span><span>
</span><span id="line-1311"></span><span class="annot"><a href="GHC.Tc.Types.html#tcTyThingCategory"><span class="hs-identifier hs-var">tcTyThingCategory</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#ATcTyCon"><span class="hs-identifier hs-type">ATcTyCon</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;local tycon&quot;</span></span><span>
</span><span id="line-1312"></span><span class="annot"><a href="GHC.Tc.Types.html#tcTyThingCategory"><span class="hs-identifier hs-var">tcTyThingCategory</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#APromotionErr"><span class="hs-identifier hs-type">APromotionErr</span></a></span><span> </span><span id="local-6989586621680879648"><span class="annot"><span class="annottext">PromotionErr
</span><a href="#local-6989586621680879648"><span class="hs-identifier hs-var">pe</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PromotionErr -&gt; FilePath
</span><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier hs-var">peCategory</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="#local-6989586621680879648"><span class="hs-identifier hs-var">pe</span></a></span><span>
</span><span id="line-1313"></span><span>
</span><span id="line-1314"></span><span class="hs-comment">--------------</span><span>
</span><span id="line-1315"></span><span class="annot"><a href="GHC.Tc.Types.html#pprPECategory"><span class="hs-identifier hs-type">pprPECategory</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#PromotionErr"><span class="hs-identifier hs-type">PromotionErr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1316"></span><span id="pprPECategory"><span class="annot"><span class="annottext">pprPECategory :: PromotionErr -&gt; SDoc
</span><a href="GHC.Tc.Types.html#pprPECategory"><span class="hs-identifier hs-var hs-var">pprPECategory</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">(FilePath -&gt; SDoc)
-&gt; (PromotionErr -&gt; FilePath) -&gt; PromotionErr -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; FilePath
</span><a href="GHC.Utils.Misc.html#capitalise"><span class="hs-identifier hs-var">capitalise</span></a></span><span> </span><span class="annot"><span class="annottext">(FilePath -&gt; FilePath)
-&gt; (PromotionErr -&gt; FilePath) -&gt; PromotionErr -&gt; FilePath
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr -&gt; FilePath
</span><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier hs-var">peCategory</span></a></span><span>
</span><span id="line-1317"></span><span>
</span><span id="line-1318"></span><span class="annot"><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier hs-type">peCategory</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#PromotionErr"><span class="hs-identifier hs-type">PromotionErr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-1319"></span><span id="peCategory"><span class="annot"><span class="annottext">peCategory :: PromotionErr -&gt; FilePath
</span><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier hs-var hs-var">peCategory</span></a></span></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#ClassPE"><span class="hs-identifier hs-var">ClassPE</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;class&quot;</span></span><span>
</span><span id="line-1320"></span><span class="annot"><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier hs-var">peCategory</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#TyConPE"><span class="hs-identifier hs-var">TyConPE</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;type constructor&quot;</span></span><span>
</span><span id="line-1321"></span><span class="annot"><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier hs-var">peCategory</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#PatSynPE"><span class="hs-identifier hs-var">PatSynPE</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;pattern synonym&quot;</span></span><span>
</span><span id="line-1322"></span><span class="annot"><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier hs-var">peCategory</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#FamDataConPE"><span class="hs-identifier hs-var">FamDataConPE</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;data constructor&quot;</span></span><span>
</span><span id="line-1323"></span><span class="annot"><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier hs-var">peCategory</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ConstrainedDataConPE"><span class="hs-identifier hs-type">ConstrainedDataConPE</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;data constructor&quot;</span></span><span>
</span><span id="line-1324"></span><span class="annot"><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier hs-var">peCategory</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#RecDataConPE"><span class="hs-identifier hs-var">RecDataConPE</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;data constructor&quot;</span></span><span>
</span><span id="line-1325"></span><span class="annot"><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier hs-var">peCategory</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#NoDataKindsTC"><span class="hs-identifier hs-var">NoDataKindsTC</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;type constructor&quot;</span></span><span>
</span><span id="line-1326"></span><span class="annot"><a href="GHC.Tc.Types.html#peCategory"><span class="hs-identifier hs-var">peCategory</span></a></span><span> </span><span class="annot"><span class="annottext">PromotionErr
</span><a href="GHC.Tc.Types.html#NoDataKindsDC"><span class="hs-identifier hs-var">NoDataKindsDC</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;data constructor&quot;</span></span><span>
</span><span id="line-1327"></span><span>
</span><span id="line-1328"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
        Operations over ImportAvails
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1335"></span><span>
</span><span id="line-1336"></span><span class="hs-comment">-- | 'ImportAvails' summarises what was imported from where, irrespective of</span><span>
</span><span id="line-1337"></span><span class="hs-comment">-- whether the imported things are actually used or not.  It is used:</span><span>
</span><span id="line-1338"></span><span class="hs-comment">--</span><span>
</span><span id="line-1339"></span><span class="hs-comment">--  * when processing the export list,</span><span>
</span><span id="line-1340"></span><span class="hs-comment">--</span><span>
</span><span id="line-1341"></span><span class="hs-comment">--  * when constructing usage info for the interface file,</span><span>
</span><span id="line-1342"></span><span class="hs-comment">--</span><span>
</span><span id="line-1343"></span><span class="hs-comment">--  * to identify the list of directly imported modules for initialisation</span><span>
</span><span id="line-1344"></span><span class="hs-comment">--    purposes and for optimised overlap checking of family instances,</span><span>
</span><span id="line-1345"></span><span class="hs-comment">--</span><span>
</span><span id="line-1346"></span><span class="hs-comment">--  * when figuring out what things are really unused</span><span>
</span><span id="line-1347"></span><span class="hs-comment">--</span><span>
</span><span id="line-1348"></span><span class="hs-keyword">data</span><span> </span><span id="ImportAvails"><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-var">ImportAvails</span></a></span></span><span>
</span><span id="line-1349"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="ImportAvails"><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-var">ImportAvails</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-1350"></span><span>        </span><span id="imp_mods"><span class="annot"><span class="annottext">ImportAvails -&gt; ImportedMods
</span><a href="GHC.Tc.Types.html#imp_mods"><span class="hs-identifier hs-var hs-var">imp_mods</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ImportedMods"><span class="hs-identifier hs-type">ImportedMods</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1351"></span><span>          </span><span class="hs-comment">--      = ModuleEnv [ImportedModsVal],</span><span>
</span><span id="line-1352"></span><span>          </span><span class="hs-comment">-- ^ Domain is all directly-imported modules</span><span>
</span><span id="line-1353"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-1354"></span><span>          </span><span class="hs-comment">-- See the documentation on ImportedModsVal in &quot;GHC.Driver.Types&quot; for the</span><span>
</span><span id="line-1355"></span><span>          </span><span class="hs-comment">-- meaning of the fields.</span><span>
</span><span id="line-1356"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-1357"></span><span>          </span><span class="hs-comment">-- We need a full ModuleEnv rather than a ModuleNameEnv here,</span><span>
</span><span id="line-1358"></span><span>          </span><span class="hs-comment">-- because we might be importing modules of the same name from</span><span>
</span><span id="line-1359"></span><span>          </span><span class="hs-comment">-- different packages. (currently not the case, but might be in the</span><span>
</span><span id="line-1360"></span><span>          </span><span class="hs-comment">-- future).</span><span>
</span><span id="line-1361"></span><span>
</span><span id="line-1362"></span><span>        </span><span id="imp_dep_mods"><span class="annot"><span class="annottext">ImportAvails -&gt; ModuleNameEnv ModuleNameWithIsBoot
</span><a href="GHC.Tc.Types.html#imp_dep_mods"><span class="hs-identifier hs-var hs-var">imp_dep_mods</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Env.html#ModuleNameEnv"><span class="hs-identifier hs-type">ModuleNameEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#ModuleNameWithIsBoot"><span class="hs-identifier hs-type">ModuleNameWithIsBoot</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1363"></span><span>          </span><span class="hs-comment">-- ^ Home-package modules needed by the module being compiled</span><span>
</span><span id="line-1364"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-1365"></span><span>          </span><span class="hs-comment">-- It doesn't matter whether any of these dependencies</span><span>
</span><span id="line-1366"></span><span>          </span><span class="hs-comment">-- are actually /used/ when compiling the module; they</span><span>
</span><span id="line-1367"></span><span>          </span><span class="hs-comment">-- are listed if they are below it at all.  For</span><span>
</span><span id="line-1368"></span><span>          </span><span class="hs-comment">-- example, suppose M imports A which imports X.  Then</span><span>
</span><span id="line-1369"></span><span>          </span><span class="hs-comment">-- compiling M might not need to consult X.hi, but X</span><span>
</span><span id="line-1370"></span><span>          </span><span class="hs-comment">-- is still listed in M's dependencies.</span><span>
</span><span id="line-1371"></span><span>
</span><span id="line-1372"></span><span>        </span><span id="imp_dep_pkgs"><span class="annot"><span class="annottext">ImportAvails -&gt; Set UnitId
</span><a href="GHC.Tc.Types.html#imp_dep_pkgs"><span class="hs-identifier hs-var hs-var">imp_dep_pkgs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../containers/src/Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1373"></span><span>          </span><span class="hs-comment">-- ^ Packages needed by the module being compiled, whether directly,</span><span>
</span><span id="line-1374"></span><span>          </span><span class="hs-comment">-- or via other modules in this package, or via modules imported</span><span>
</span><span id="line-1375"></span><span>          </span><span class="hs-comment">-- from other packages.</span><span>
</span><span id="line-1376"></span><span>
</span><span id="line-1377"></span><span>        </span><span id="imp_trust_pkgs"><span class="annot"><span class="annottext">ImportAvails -&gt; Set UnitId
</span><a href="GHC.Tc.Types.html#imp_trust_pkgs"><span class="hs-identifier hs-var hs-var">imp_trust_pkgs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../containers/src/Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1378"></span><span>          </span><span class="hs-comment">-- ^ This is strictly a subset of imp_dep_pkgs and records the</span><span>
</span><span id="line-1379"></span><span>          </span><span class="hs-comment">-- packages the current module needs to trust for Safe Haskell</span><span>
</span><span id="line-1380"></span><span>          </span><span class="hs-comment">-- compilation to succeed. A package is required to be trusted if</span><span>
</span><span id="line-1381"></span><span>          </span><span class="hs-comment">-- we are dependent on a trustworthy module in that package.</span><span>
</span><span id="line-1382"></span><span>          </span><span class="hs-comment">-- While perhaps making imp_dep_pkgs a tuple of (UnitId, Bool)</span><span>
</span><span id="line-1383"></span><span>          </span><span class="hs-comment">-- where True for the bool indicates the package is required to be</span><span>
</span><span id="line-1384"></span><span>          </span><span class="hs-comment">-- trusted is the more logical  design, doing so complicates a lot</span><span>
</span><span id="line-1385"></span><span>          </span><span class="hs-comment">-- of code not concerned with Safe Haskell.</span><span>
</span><span id="line-1386"></span><span>          </span><span class="hs-comment">-- See Note [Tracking Trust Transitively] in &quot;GHC.Rename.Names&quot;</span><span>
</span><span id="line-1387"></span><span>
</span><span id="line-1388"></span><span>        </span><span id="imp_trust_own_pkg"><span class="annot"><span class="annottext">ImportAvails -&gt; Bool
</span><a href="GHC.Tc.Types.html#imp_trust_own_pkg"><span class="hs-identifier hs-var hs-var">imp_trust_own_pkg</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span>
</span><span id="line-1389"></span><span>          </span><span class="hs-comment">-- ^ Do we require that our own package is trusted?</span><span>
</span><span id="line-1390"></span><span>          </span><span class="hs-comment">-- This is to handle efficiently the case where a Safe module imports</span><span>
</span><span id="line-1391"></span><span>          </span><span class="hs-comment">-- a Trustworthy module that resides in the same package as it.</span><span>
</span><span id="line-1392"></span><span>          </span><span class="hs-comment">-- See Note [Trust Own Package] in &quot;GHC.Rename.Names&quot;</span><span>
</span><span id="line-1393"></span><span>
</span><span id="line-1394"></span><span>        </span><span id="imp_orphs"><span class="annot"><span class="annottext">ImportAvails -&gt; [Module]
</span><a href="GHC.Tc.Types.html#imp_orphs"><span class="hs-identifier hs-var hs-var">imp_orphs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-1395"></span><span>          </span><span class="hs-comment">-- ^ Orphan modules below us in the import tree (and maybe including</span><span>
</span><span id="line-1396"></span><span>          </span><span class="hs-comment">-- us for imported modules)</span><span>
</span><span id="line-1397"></span><span>
</span><span id="line-1398"></span><span>        </span><span id="imp_finsts"><span class="annot"><span class="annottext">ImportAvails -&gt; [Module]
</span><a href="GHC.Tc.Types.html#imp_finsts"><span class="hs-identifier hs-var hs-var">imp_finsts</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1399"></span><span>          </span><span class="hs-comment">-- ^ Family instance modules below us in the import tree (and maybe</span><span>
</span><span id="line-1400"></span><span>          </span><span class="hs-comment">-- including us for imported modules)</span><span>
</span><span id="line-1401"></span><span>      </span><span class="hs-special">}</span><span>
</span><span id="line-1402"></span><span>
</span><span id="line-1403"></span><span class="annot"><a href="GHC.Tc.Types.html#mkModDeps"><span class="hs-identifier hs-type">mkModDeps</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#ModuleNameWithIsBoot"><span class="hs-identifier hs-type">ModuleNameWithIsBoot</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1404"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Env.html#ModuleNameEnv"><span class="hs-identifier hs-type">ModuleNameEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#ModuleNameWithIsBoot"><span class="hs-identifier hs-type">ModuleNameWithIsBoot</span></a></span><span>
</span><span id="line-1405"></span><span id="mkModDeps"><span class="annot"><span class="annottext">mkModDeps :: [ModuleNameWithIsBoot] -&gt; ModuleNameEnv ModuleNameWithIsBoot
</span><a href="GHC.Tc.Types.html#mkModDeps"><span class="hs-identifier hs-var hs-var">mkModDeps</span></a></span></span><span> </span><span id="local-6989586621680879640"><span class="annot"><span class="annottext">[ModuleNameWithIsBoot]
</span><a href="#local-6989586621680879640"><span class="hs-identifier hs-var">deps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ModuleNameEnv ModuleNameWithIsBoot
 -&gt; ModuleNameWithIsBoot -&gt; ModuleNameEnv ModuleNameWithIsBoot)
-&gt; ModuleNameEnv ModuleNameWithIsBoot
-&gt; [ModuleNameWithIsBoot]
-&gt; ModuleNameEnv ModuleNameWithIsBoot
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleNameEnv ModuleNameWithIsBoot
-&gt; ModuleNameWithIsBoot -&gt; ModuleNameEnv ModuleNameWithIsBoot
forall {key}.
Uniquable key =&gt;
UniqFM key (GenWithIsBoot key)
-&gt; GenWithIsBoot key -&gt; UniqFM key (GenWithIsBoot key)
</span><a href="#local-6989586621680879638"><span class="hs-identifier hs-var">add</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleNameEnv ModuleNameWithIsBoot
forall key elt. UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#emptyUFM"><span class="hs-identifier hs-var">emptyUFM</span></a></span><span> </span><span class="annot"><span class="annottext">[ModuleNameWithIsBoot]
</span><a href="#local-6989586621680879640"><span class="hs-identifier hs-var">deps</span></a></span><span>
</span><span id="line-1406"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1407"></span><span>    </span><span id="local-6989586621680879638"><span class="annot"><span class="annottext">add :: UniqFM key (GenWithIsBoot key)
-&gt; GenWithIsBoot key -&gt; UniqFM key (GenWithIsBoot key)
</span><a href="#local-6989586621680879638"><span class="hs-identifier hs-var hs-var">add</span></a></span></span><span> </span><span id="local-6989586621680879634"><span class="annot"><span class="annottext">UniqFM key (GenWithIsBoot key)
</span><a href="#local-6989586621680879634"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680879633"><span class="annot"><span class="annottext">GenWithIsBoot key
</span><a href="#local-6989586621680879633"><span class="hs-identifier hs-var">elt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM key (GenWithIsBoot key)
-&gt; key -&gt; GenWithIsBoot key -&gt; UniqFM key (GenWithIsBoot key)
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM key (GenWithIsBoot key)
</span><a href="#local-6989586621680879634"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenWithIsBoot key -&gt; key
forall mod. GenWithIsBoot mod -&gt; mod
</span><a href="GHC.Unit.Types.html#gwib_mod"><span class="hs-identifier hs-var hs-var">gwib_mod</span></a></span><span> </span><span class="annot"><span class="annottext">GenWithIsBoot key
</span><a href="#local-6989586621680879633"><span class="hs-identifier hs-var">elt</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">GenWithIsBoot key
</span><a href="#local-6989586621680879633"><span class="hs-identifier hs-var">elt</span></a></span><span>
</span><span id="line-1408"></span><span>
</span><span id="line-1409"></span><span class="annot"><a href="GHC.Tc.Types.html#modDepsElts"><span class="hs-identifier hs-type">modDepsElts</span></a></span><span>
</span><span id="line-1410"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Env.html#ModuleNameEnv"><span class="hs-identifier hs-type">ModuleNameEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#ModuleNameWithIsBoot"><span class="hs-identifier hs-type">ModuleNameWithIsBoot</span></a></span><span>
</span><span id="line-1411"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#ModuleNameWithIsBoot"><span class="hs-identifier hs-type">ModuleNameWithIsBoot</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1412"></span><span id="modDepsElts"><span class="annot"><span class="annottext">modDepsElts :: ModuleNameEnv ModuleNameWithIsBoot -&gt; [ModuleNameWithIsBoot]
</span><a href="GHC.Tc.Types.html#modDepsElts"><span class="hs-identifier hs-var hs-var">modDepsElts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ModuleNameWithIsBoot] -&gt; [ModuleNameWithIsBoot]
forall a. Ord a =&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#sort"><span class="hs-identifier hs-var">sort</span></a></span><span> </span><span class="annot"><span class="annottext">([ModuleNameWithIsBoot] -&gt; [ModuleNameWithIsBoot])
-&gt; (ModuleNameEnv ModuleNameWithIsBoot -&gt; [ModuleNameWithIsBoot])
-&gt; ModuleNameEnv ModuleNameWithIsBoot
-&gt; [ModuleNameWithIsBoot]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleNameEnv ModuleNameWithIsBoot -&gt; [ModuleNameWithIsBoot]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span>
</span><span id="line-1413"></span><span>  </span><span class="hs-comment">-- It's OK to use nonDetEltsUFM here because sorting by module names</span><span>
</span><span id="line-1414"></span><span>  </span><span class="hs-comment">-- restores determinism</span><span>
</span><span id="line-1415"></span><span>
</span><span id="line-1416"></span><span class="annot"><a href="GHC.Tc.Types.html#emptyImportAvails"><span class="hs-identifier hs-type">emptyImportAvails</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span>
</span><span id="line-1417"></span><span id="emptyImportAvails"><span class="annot"><span class="annottext">emptyImportAvails :: ImportAvails
</span><a href="GHC.Tc.Types.html#emptyImportAvails"><span class="hs-identifier hs-var hs-var">emptyImportAvails</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportAvails :: ImportedMods
-&gt; ModuleNameEnv ModuleNameWithIsBoot
-&gt; Set UnitId
-&gt; Set UnitId
-&gt; Bool
-&gt; [Module]
-&gt; [Module]
-&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">imp_mods :: ImportedMods
</span><a href="GHC.Tc.Types.html#imp_mods"><span class="hs-identifier hs-var">imp_mods</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportedMods
forall a. ModuleEnv a
</span><a href="GHC.Unit.Module.Env.html#emptyModuleEnv"><span class="hs-identifier hs-var">emptyModuleEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1418"></span><span>                                   </span><span class="annot"><span class="annottext">imp_dep_mods :: ModuleNameEnv ModuleNameWithIsBoot
</span><a href="GHC.Tc.Types.html#imp_dep_mods"><span class="hs-identifier hs-var">imp_dep_mods</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleNameEnv ModuleNameWithIsBoot
forall key elt. UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#emptyUFM"><span class="hs-identifier hs-var">emptyUFM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1419"></span><span>                                   </span><span class="annot"><span class="annottext">imp_dep_pkgs :: Set UnitId
</span><a href="GHC.Tc.Types.html#imp_dep_pkgs"><span class="hs-identifier hs-var">imp_dep_pkgs</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set UnitId
forall a. Set a
</span><a href="../../containers/src/Data.Set.Internal.html#empty"><span class="hs-identifier hs-var">S.empty</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1420"></span><span>                                   </span><span class="annot"><span class="annottext">imp_trust_pkgs :: Set UnitId
</span><a href="GHC.Tc.Types.html#imp_trust_pkgs"><span class="hs-identifier hs-var">imp_trust_pkgs</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set UnitId
forall a. Set a
</span><a href="../../containers/src/Data.Set.Internal.html#empty"><span class="hs-identifier hs-var">S.empty</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1421"></span><span>                                   </span><span class="annot"><span class="annottext">imp_trust_own_pkg :: Bool
</span><a href="GHC.Tc.Types.html#imp_trust_own_pkg"><span class="hs-identifier hs-var">imp_trust_own_pkg</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span>
</span><span id="line-1422"></span><span>                                   </span><span class="annot"><span class="annottext">imp_orphs :: [Module]
</span><a href="GHC.Tc.Types.html#imp_orphs"><span class="hs-identifier hs-var">imp_orphs</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-1423"></span><span>                                   </span><span class="annot"><span class="annottext">imp_finsts :: [Module]
</span><a href="GHC.Tc.Types.html#imp_finsts"><span class="hs-identifier hs-var">imp_finsts</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1424"></span><span>
</span><span id="line-1425"></span><span class="hs-comment">-- | Union two ImportAvails</span><span>
</span><span id="line-1426"></span><span class="hs-comment">--</span><span>
</span><span id="line-1427"></span><span class="hs-comment">-- This function is a key part of Import handling, basically</span><span>
</span><span id="line-1428"></span><span class="hs-comment">-- for each import we create a separate ImportAvails structure</span><span>
</span><span id="line-1429"></span><span class="hs-comment">-- and then union them all together with this function.</span><span>
</span><span id="line-1430"></span><span class="annot"><a href="GHC.Tc.Types.html#plusImportAvails"><span class="hs-identifier hs-type">plusImportAvails</span></a></span><span> </span><span class="hs-glyph">::</span><span>  </span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>  </span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>  </span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span>
</span><span id="line-1431"></span><span id="plusImportAvails"><span class="annot"><span class="annottext">plusImportAvails :: ImportAvails -&gt; ImportAvails -&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#plusImportAvails"><span class="hs-identifier hs-var hs-var">plusImportAvails</span></a></span></span><span>
</span><span id="line-1432"></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">imp_mods :: ImportAvails -&gt; ImportedMods
</span><a href="GHC.Tc.Types.html#imp_mods"><span class="hs-identifier hs-var">imp_mods</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879627"><span class="annot"><span class="annottext">ImportedMods
</span><a href="#local-6989586621680879627"><span class="hs-identifier hs-var">mods1</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-1433"></span><span>                  </span><span class="annot"><span class="annottext">imp_dep_mods :: ImportAvails -&gt; ModuleNameEnv ModuleNameWithIsBoot
</span><a href="GHC.Tc.Types.html#imp_dep_mods"><span class="hs-identifier hs-var">imp_dep_mods</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879626"><span class="annot"><span class="annottext">ModuleNameEnv ModuleNameWithIsBoot
</span><a href="#local-6989586621680879626"><span class="hs-identifier hs-var">dmods1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">imp_dep_pkgs :: ImportAvails -&gt; Set UnitId
</span><a href="GHC.Tc.Types.html#imp_dep_pkgs"><span class="hs-identifier hs-var">imp_dep_pkgs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879625"><span class="annot"><span class="annottext">Set UnitId
</span><a href="#local-6989586621680879625"><span class="hs-identifier hs-var">dpkgs1</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-1434"></span><span>                  </span><span class="annot"><span class="annottext">imp_trust_pkgs :: ImportAvails -&gt; Set UnitId
</span><a href="GHC.Tc.Types.html#imp_trust_pkgs"><span class="hs-identifier hs-var">imp_trust_pkgs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879624"><span class="annot"><span class="annottext">Set UnitId
</span><a href="#local-6989586621680879624"><span class="hs-identifier hs-var">tpkgs1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">imp_trust_own_pkg :: ImportAvails -&gt; Bool
</span><a href="GHC.Tc.Types.html#imp_trust_own_pkg"><span class="hs-identifier hs-var">imp_trust_own_pkg</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879623"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680879623"><span class="hs-identifier hs-var">tself1</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-1435"></span><span>                  </span><span class="annot"><span class="annottext">imp_orphs :: ImportAvails -&gt; [Module]
</span><a href="GHC.Tc.Types.html#imp_orphs"><span class="hs-identifier hs-var">imp_orphs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879622"><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621680879622"><span class="hs-identifier hs-var">orphs1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">imp_finsts :: ImportAvails -&gt; [Module]
</span><a href="GHC.Tc.Types.html#imp_finsts"><span class="hs-identifier hs-var">imp_finsts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879621"><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621680879621"><span class="hs-identifier hs-var">finsts1</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1436"></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">imp_mods :: ImportAvails -&gt; ImportedMods
</span><a href="GHC.Tc.Types.html#imp_mods"><span class="hs-identifier hs-var">imp_mods</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879620"><span class="annot"><span class="annottext">ImportedMods
</span><a href="#local-6989586621680879620"><span class="hs-identifier hs-var">mods2</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-1437"></span><span>                  </span><span class="annot"><span class="annottext">imp_dep_mods :: ImportAvails -&gt; ModuleNameEnv ModuleNameWithIsBoot
</span><a href="GHC.Tc.Types.html#imp_dep_mods"><span class="hs-identifier hs-var">imp_dep_mods</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879619"><span class="annot"><span class="annottext">ModuleNameEnv ModuleNameWithIsBoot
</span><a href="#local-6989586621680879619"><span class="hs-identifier hs-var">dmods2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">imp_dep_pkgs :: ImportAvails -&gt; Set UnitId
</span><a href="GHC.Tc.Types.html#imp_dep_pkgs"><span class="hs-identifier hs-var">imp_dep_pkgs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879618"><span class="annot"><span class="annottext">Set UnitId
</span><a href="#local-6989586621680879618"><span class="hs-identifier hs-var">dpkgs2</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-1438"></span><span>                  </span><span class="annot"><span class="annottext">imp_trust_pkgs :: ImportAvails -&gt; Set UnitId
</span><a href="GHC.Tc.Types.html#imp_trust_pkgs"><span class="hs-identifier hs-var">imp_trust_pkgs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879617"><span class="annot"><span class="annottext">Set UnitId
</span><a href="#local-6989586621680879617"><span class="hs-identifier hs-var">tpkgs2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">imp_trust_own_pkg :: ImportAvails -&gt; Bool
</span><a href="GHC.Tc.Types.html#imp_trust_own_pkg"><span class="hs-identifier hs-var">imp_trust_own_pkg</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879616"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680879616"><span class="hs-identifier hs-var">tself2</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-1439"></span><span>                  </span><span class="annot"><span class="annottext">imp_orphs :: ImportAvails -&gt; [Module]
</span><a href="GHC.Tc.Types.html#imp_orphs"><span class="hs-identifier hs-var">imp_orphs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879615"><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621680879615"><span class="hs-identifier hs-var">orphs2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">imp_finsts :: ImportAvails -&gt; [Module]
</span><a href="GHC.Tc.Types.html#imp_finsts"><span class="hs-identifier hs-var">imp_finsts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879614"><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621680879614"><span class="hs-identifier hs-var">finsts2</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1440"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportAvails :: ImportedMods
-&gt; ModuleNameEnv ModuleNameWithIsBoot
-&gt; Set UnitId
-&gt; Set UnitId
-&gt; Bool
-&gt; [Module]
-&gt; [Module]
-&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">imp_mods :: ImportedMods
</span><a href="GHC.Tc.Types.html#imp_mods"><span class="hs-identifier hs-var">imp_mods</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([ImportedBy] -&gt; [ImportedBy] -&gt; [ImportedBy])
-&gt; ImportedMods -&gt; ImportedMods -&gt; ImportedMods
forall a.
(a -&gt; a -&gt; a) -&gt; ModuleEnv a -&gt; ModuleEnv a -&gt; ModuleEnv a
</span><a href="GHC.Unit.Module.Env.html#plusModuleEnv_C"><span class="hs-identifier hs-var">plusModuleEnv_C</span></a></span><span> </span><span class="annot"><span class="annottext">[ImportedBy] -&gt; [ImportedBy] -&gt; [ImportedBy]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">(++)</span></a></span><span> </span><span class="annot"><span class="annottext">ImportedMods
</span><a href="#local-6989586621680879627"><span class="hs-identifier hs-var">mods1</span></a></span><span> </span><span class="annot"><span class="annottext">ImportedMods
</span><a href="#local-6989586621680879620"><span class="hs-identifier hs-var">mods2</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1441"></span><span>                   </span><span class="annot"><span class="annottext">imp_dep_mods :: ModuleNameEnv ModuleNameWithIsBoot
</span><a href="GHC.Tc.Types.html#imp_dep_mods"><span class="hs-identifier hs-var">imp_dep_mods</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ModuleNameWithIsBoot
 -&gt; ModuleNameWithIsBoot -&gt; ModuleNameWithIsBoot)
-&gt; ModuleNameEnv ModuleNameWithIsBoot
-&gt; ModuleNameEnv ModuleNameWithIsBoot
-&gt; ModuleNameEnv ModuleNameWithIsBoot
forall elt key.
(elt -&gt; elt -&gt; elt)
-&gt; UniqFM key elt -&gt; UniqFM key elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#plusUFM_C"><span class="hs-identifier hs-var">plusUFM_C</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleNameWithIsBoot
-&gt; ModuleNameWithIsBoot -&gt; ModuleNameWithIsBoot
forall {a}.
(Eq a, Outputable a) =&gt;
GenWithIsBoot a -&gt; GenWithIsBoot a -&gt; GenWithIsBoot a
</span><a href="#local-6989586621680879611"><span class="hs-identifier hs-var">plus_mod_dep</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleNameEnv ModuleNameWithIsBoot
</span><a href="#local-6989586621680879626"><span class="hs-identifier hs-var">dmods1</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleNameEnv ModuleNameWithIsBoot
</span><a href="#local-6989586621680879619"><span class="hs-identifier hs-var">dmods2</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1442"></span><span>                   </span><span class="annot"><span class="annottext">imp_dep_pkgs :: Set UnitId
</span><a href="GHC.Tc.Types.html#imp_dep_pkgs"><span class="hs-identifier hs-var">imp_dep_pkgs</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set UnitId
</span><a href="#local-6989586621680879625"><span class="hs-identifier hs-var">dpkgs1</span></a></span><span> </span><span class="annot"><span class="annottext">Set UnitId -&gt; Set UnitId -&gt; Set UnitId
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="../../containers/src/Data.Set.Internal.html#union"><span class="hs-operator hs-var">`S.union`</span></a></span><span> </span><span class="annot"><span class="annottext">Set UnitId
</span><a href="#local-6989586621680879618"><span class="hs-identifier hs-var">dpkgs2</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1443"></span><span>                   </span><span class="annot"><span class="annottext">imp_trust_pkgs :: Set UnitId
</span><a href="GHC.Tc.Types.html#imp_trust_pkgs"><span class="hs-identifier hs-var">imp_trust_pkgs</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set UnitId
</span><a href="#local-6989586621680879624"><span class="hs-identifier hs-var">tpkgs1</span></a></span><span> </span><span class="annot"><span class="annottext">Set UnitId -&gt; Set UnitId -&gt; Set UnitId
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="../../containers/src/Data.Set.Internal.html#union"><span class="hs-operator hs-var">`S.union`</span></a></span><span> </span><span class="annot"><span class="annottext">Set UnitId
</span><a href="#local-6989586621680879617"><span class="hs-identifier hs-var">tpkgs2</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1444"></span><span>                   </span><span class="annot"><span class="annottext">imp_trust_own_pkg :: Bool
</span><a href="GHC.Tc.Types.html#imp_trust_own_pkg"><span class="hs-identifier hs-var">imp_trust_own_pkg</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680879623"><span class="hs-identifier hs-var">tself1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680879616"><span class="hs-identifier hs-var">tself2</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1445"></span><span>                   </span><span class="annot"><span class="annottext">imp_orphs :: [Module]
</span><a href="GHC.Tc.Types.html#imp_orphs"><span class="hs-identifier hs-var">imp_orphs</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621680879622"><span class="hs-identifier hs-var">orphs1</span></a></span><span> </span><span class="annot"><span class="annottext">[Module] -&gt; [Module] -&gt; [Module]
forall a.
(HasDebugCallStack, Outputable a, Eq a) =&gt;
[a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Data.List.SetOps.html#unionLists"><span class="hs-operator hs-var">`unionLists`</span></a></span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621680879615"><span class="hs-identifier hs-var">orphs2</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1446"></span><span>                   </span><span class="annot"><span class="annottext">imp_finsts :: [Module]
</span><a href="GHC.Tc.Types.html#imp_finsts"><span class="hs-identifier hs-var">imp_finsts</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621680879621"><span class="hs-identifier hs-var">finsts1</span></a></span><span> </span><span class="annot"><span class="annottext">[Module] -&gt; [Module] -&gt; [Module]
forall a.
(HasDebugCallStack, Outputable a, Eq a) =&gt;
[a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Data.List.SetOps.html#unionLists"><span class="hs-operator hs-var">`unionLists`</span></a></span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621680879614"><span class="hs-identifier hs-var">finsts2</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1447"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1448"></span><span>    </span><span id="local-6989586621680879611"><span class="annot"><span class="annottext">plus_mod_dep :: GenWithIsBoot a -&gt; GenWithIsBoot a -&gt; GenWithIsBoot a
</span><a href="#local-6989586621680879611"><span class="hs-identifier hs-var hs-var">plus_mod_dep</span></a></span></span><span> </span><span id="local-6989586621680879594"><span class="annot"><span class="annottext">r1 :: GenWithIsBoot a
</span><a href="#local-6989586621680879594"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#GWIB"><span class="hs-identifier hs-type">GWIB</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">gwib_mod :: forall mod. GenWithIsBoot mod -&gt; mod
</span><a href="GHC.Unit.Types.html#gwib_mod"><span class="hs-identifier hs-var">gwib_mod</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879592"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680879592"><span class="hs-identifier hs-var">m1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">gwib_isBoot :: forall mod. GenWithIsBoot mod -&gt; IsBootInterface
</span><a href="GHC.Unit.Types.html#gwib_isBoot"><span class="hs-identifier hs-var">gwib_isBoot</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879590"><span class="annot"><span class="annottext">IsBootInterface
</span><a href="#local-6989586621680879590"><span class="hs-identifier hs-var">boot1</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1449"></span><span>                 </span><span id="local-6989586621680879589"><span class="annot"><span class="annottext">r2 :: GenWithIsBoot a
</span><a href="#local-6989586621680879589"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#GWIB"><span class="hs-identifier hs-type">GWIB</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">gwib_mod :: forall mod. GenWithIsBoot mod -&gt; mod
</span><a href="GHC.Unit.Types.html#gwib_mod"><span class="hs-identifier hs-var">gwib_mod</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879588"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680879588"><span class="hs-identifier hs-var">m2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">gwib_isBoot :: forall mod. GenWithIsBoot mod -&gt; IsBootInterface
</span><a href="GHC.Unit.Types.html#gwib_isBoot"><span class="hs-identifier hs-var">gwib_isBoot</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879587"><span class="annot"><span class="annottext">IsBootInterface
</span><a href="#local-6989586621680879587"><span class="hs-identifier hs-var">boot2</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1450"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">m1</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">m2</span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">m1</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">m2</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ppr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">boot1</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">IsBoot</span><span class="hs-special">)</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">boot2</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">IsBoot</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1451"></span><span>        </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="#local-6989586621680879590"><span class="hs-identifier hs-var">boot1</span></a></span><span> </span><span class="annot"><span class="annottext">IsBootInterface -&gt; IsBootInterface -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#IsBoot"><span class="hs-identifier hs-var">IsBoot</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenWithIsBoot a
</span><a href="#local-6989586621680879589"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-1452"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenWithIsBoot a
</span><a href="#local-6989586621680879594"><span class="hs-identifier hs-var">r1</span></a></span><span>
</span><span id="line-1453"></span><span>      </span><span class="hs-comment">-- If either side can &quot;see&quot; a non-hi-boot interface, use that</span><span>
</span><span id="line-1454"></span><span>      </span><span class="hs-comment">-- Reusing existing tuples saves 10% of allocations on test</span><span>
</span><span id="line-1455"></span><span>      </span><span class="hs-comment">-- perf/compiler/MultiLayerModules</span><span>
</span><span id="line-1456"></span><span>
</span><span id="line-1457"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Where from}
*                                                                      *
************************************************************************

The @WhereFrom@ type controls where the renamer looks for an interface file
-}</span><span>
</span><span id="line-1466"></span><span>
</span><span id="line-1467"></span><span class="hs-keyword">data</span><span> </span><span id="WhereFrom"><span class="annot"><a href="GHC.Tc.Types.html#WhereFrom"><span class="hs-identifier hs-var">WhereFrom</span></a></span></span><span>
</span><span id="line-1468"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="ImportByUser"><span class="annot"><a href="GHC.Tc.Types.html#ImportByUser"><span class="hs-identifier hs-var">ImportByUser</span></a></span></span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#IsBootInterface"><span class="hs-identifier hs-type">IsBootInterface</span></a></span><span>        </span><span class="hs-comment">-- Ordinary user import (perhaps {-# SOURCE #-})</span><span>
</span><span id="line-1469"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ImportBySystem"><span class="annot"><a href="GHC.Tc.Types.html#ImportBySystem"><span class="hs-identifier hs-var">ImportBySystem</span></a></span></span><span>                      </span><span class="hs-comment">-- Non user import.</span><span>
</span><span id="line-1470"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ImportByPlugin"><span class="annot"><a href="GHC.Tc.Types.html#ImportByPlugin"><span class="hs-identifier hs-var">ImportByPlugin</span></a></span></span><span>                      </span><span class="hs-comment">-- Importing a plugin;</span><span>
</span><span id="line-1471"></span><span>                                        </span><span class="hs-comment">-- See Note [Care with plugin imports] in GHC.Iface.Load</span><span>
</span><span id="line-1472"></span><span>
</span><span id="line-1473"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879575"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#WhereFrom"><span class="hs-identifier hs-type">WhereFrom</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1474"></span><span>  </span><span id="local-6989586621680879574"><span class="annot"><span class="annottext">ppr :: WhereFrom -&gt; SDoc
</span><a href="#local-6989586621680879574"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#ImportByUser"><span class="hs-identifier hs-type">ImportByUser</span></a></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#IsBoot"><span class="hs-identifier hs-var">IsBoot</span></a></span><span class="hs-special">)</span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;{- SOURCE -}&quot;</span></span><span>
</span><span id="line-1475"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#ImportByUser"><span class="hs-identifier hs-type">ImportByUser</span></a></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#NotBoot"><span class="hs-identifier hs-var">NotBoot</span></a></span><span class="hs-special">)</span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1476"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">WhereFrom
</span><a href="GHC.Tc.Types.html#ImportBySystem"><span class="hs-identifier hs-var">ImportBySystem</span></a></span><span>                       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;{- SYSTEM -}&quot;</span></span><span>
</span><span id="line-1477"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">WhereFrom
</span><a href="GHC.Tc.Types.html#ImportByPlugin"><span class="hs-identifier hs-var">ImportByPlugin</span></a></span><span>                       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;{- PLUGIN -}&quot;</span></span><span>
</span><span id="line-1478"></span><span>
</span><span id="line-1479"></span><span>
</span><span id="line-1480"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                Type signatures
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1485"></span><span>
</span><span id="line-1486"></span><span class="hs-comment">-- These data types need to be here only because</span><span>
</span><span id="line-1487"></span><span class="hs-comment">-- GHC.Tc.Solver uses them, and GHC.Tc.Solver is fairly</span><span>
</span><span id="line-1488"></span><span class="hs-comment">-- low down in the module hierarchy</span><span>
</span><span id="line-1489"></span><span>
</span><span id="line-1490"></span><span class="hs-keyword">type</span><span> </span><span id="TcSigFun"><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-var">TcSigFun</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigInfo"><span class="hs-identifier hs-type">TcSigInfo</span></a></span><span>
</span><span id="line-1491"></span><span>
</span><span id="line-1492"></span><span class="hs-keyword">data</span><span> </span><span id="TcSigInfo"><span class="annot"><a href="GHC.Tc.Types.html#TcSigInfo"><span class="hs-identifier hs-var">TcSigInfo</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="TcIdSig"><span class="annot"><a href="GHC.Tc.Types.html#TcIdSig"><span class="hs-identifier hs-var">TcIdSig</span></a></span></span><span>     </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInfo"><span class="hs-identifier hs-type">TcIdSigInfo</span></a></span><span>
</span><span id="line-1493"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span id="TcPatSynSig"><span class="annot"><a href="GHC.Tc.Types.html#TcPatSynSig"><span class="hs-identifier hs-var">TcPatSynSig</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPatSynInfo"><span class="hs-identifier hs-type">TcPatSynInfo</span></a></span><span>
</span><span id="line-1494"></span><span>
</span><span id="line-1495"></span><span class="hs-keyword">data</span><span> </span><span id="TcIdSigInfo"><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInfo"><span class="hs-identifier hs-var">TcIdSigInfo</span></a></span></span><span>   </span><span class="hs-comment">-- See Note [Complete and partial type signatures]</span><span>
</span><span id="line-1496"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="CompleteSig"><span class="annot"><a href="GHC.Tc.Types.html#CompleteSig"><span class="hs-identifier hs-var">CompleteSig</span></a></span></span><span>    </span><span class="hs-comment">-- A complete signature with no wildcards,</span><span>
</span><span id="line-1497"></span><span>                   </span><span class="hs-comment">-- so the complete polymorphic type is known.</span><span>
</span><span id="line-1498"></span><span>      </span><span class="hs-special">{</span><span> </span><span id="sig_bndr"><span class="annot"><span class="annottext">TcIdSigInfo -&gt; TyVar
</span><a href="GHC.Tc.Types.html#sig_bndr"><span class="hs-identifier hs-var hs-var">sig_bndr</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span>          </span><span class="hs-comment">-- The polymorphic Id with that type</span><span>
</span><span id="line-1499"></span><span>
</span><span id="line-1500"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="sig_ctxt"><span class="annot"><span class="annottext">TcIdSigInfo -&gt; UserTypeCtxt
</span><a href="GHC.Tc.Types.html#sig_ctxt"><span class="hs-identifier hs-var hs-var">sig_ctxt</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#UserTypeCtxt"><span class="hs-identifier hs-type">UserTypeCtxt</span></a></span><span>  </span><span class="hs-comment">-- In the case of type-class default methods,</span><span>
</span><span id="line-1501"></span><span>                                  </span><span class="hs-comment">-- the Name in the FunSigCtxt is not the same</span><span>
</span><span id="line-1502"></span><span>                                  </span><span class="hs-comment">-- as the TcId; the former is 'op', while the</span><span>
</span><span id="line-1503"></span><span>                                  </span><span class="hs-comment">-- latter is '$dmop' or some such</span><span>
</span><span id="line-1504"></span><span>
</span><span id="line-1505"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="sig_loc"><span class="annot"><span class="annottext">TcIdSigInfo -&gt; SrcSpan
</span><a href="GHC.Tc.Types.html#sig_loc"><span class="hs-identifier hs-var hs-var">sig_loc</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span>       </span><span class="hs-comment">-- Location of the type signature</span><span>
</span><span id="line-1506"></span><span>      </span><span class="hs-special">}</span><span>
</span><span id="line-1507"></span><span>
</span><span id="line-1508"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="PartialSig"><span class="annot"><a href="GHC.Tc.Types.html#PartialSig"><span class="hs-identifier hs-var">PartialSig</span></a></span></span><span>     </span><span class="hs-comment">-- A partial type signature (i.e. includes one or more</span><span>
</span><span id="line-1509"></span><span>                   </span><span class="hs-comment">-- wildcards). In this case it doesn't make sense to give</span><span>
</span><span id="line-1510"></span><span>                   </span><span class="hs-comment">-- the polymorphic Id, because we are going to /infer/ its</span><span>
</span><span id="line-1511"></span><span>                   </span><span class="hs-comment">-- type, so we can't make the polymorphic Id ab-initio</span><span>
</span><span id="line-1512"></span><span>      </span><span class="hs-special">{</span><span> </span><span id="psig_name"><span class="annot"><span class="annottext">TcIdSigInfo -&gt; Name
</span><a href="GHC.Tc.Types.html#psig_name"><span class="hs-identifier hs-var hs-var">psig_name</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>   </span><span class="hs-comment">-- Name of the function; used when report wildcards</span><span>
</span><span id="line-1513"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="psig_hs_ty"><span class="annot"><span class="annottext">TcIdSigInfo -&gt; LHsSigWcType GhcRn
</span><a href="GHC.Tc.Types.html#psig_hs_ty"><span class="hs-identifier hs-var hs-var">psig_hs_ty</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#LHsSigWcType"><span class="hs-identifier hs-type">LHsSigWcType</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span>  </span><span class="hs-comment">-- The original partial signature in</span><span>
</span><span id="line-1514"></span><span>                                          </span><span class="hs-comment">-- HsSyn form</span><span>
</span><span id="line-1515"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="sig_ctxt"><span class="annot"><a href="GHC.Tc.Types.html#sig_ctxt"><span class="hs-identifier hs-var">sig_ctxt</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#UserTypeCtxt"><span class="hs-identifier hs-type">UserTypeCtxt</span></a></span><span>
</span><span id="line-1516"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="sig_loc"><span class="annot"><a href="GHC.Tc.Types.html#sig_loc"><span class="hs-identifier hs-var">sig_loc</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span>            </span><span class="hs-comment">-- Location of the type signature</span><span>
</span><span id="line-1517"></span><span>      </span><span class="hs-special">}</span><span>
</span><span id="line-1518"></span><span>
</span><span id="line-1519"></span><span>
</span><span id="line-1520"></span><span class="hs-comment">{- Note [Complete and partial type signatures]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A type signature is partial when it contains one or more wildcards
(= type holes).  The wildcard can either be:
* A (type) wildcard occurring in sig_theta or sig_tau. These are
  stored in sig_wcs.
      f :: Bool -&gt; _
      g :: Eq _a =&gt; _a -&gt; _a -&gt; Bool
* Or an extra-constraints wildcard, stored in sig_cts:
      h :: (Num a, _) =&gt; a -&gt; a

A type signature is a complete type signature when there are no
wildcards in the type signature, i.e. iff sig_wcs is empty and
sig_extra_cts is Nothing.
-}</span><span>
</span><span id="line-1535"></span><span>
</span><span id="line-1536"></span><span class="hs-keyword">data</span><span> </span><span id="TcIdSigInst"><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier hs-var">TcIdSigInst</span></a></span></span><span>
</span><span id="line-1537"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="TISI"><span class="annot"><a href="GHC.Tc.Types.html#TISI"><span class="hs-identifier hs-var">TISI</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="sig_inst_sig"><span class="annot"><span class="annottext">TcIdSigInst -&gt; TcIdSigInfo
</span><a href="GHC.Tc.Types.html#sig_inst_sig"><span class="hs-identifier hs-var hs-var">sig_inst_sig</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInfo"><span class="hs-identifier hs-type">TcIdSigInfo</span></a></span><span>
</span><span id="line-1538"></span><span>
</span><span id="line-1539"></span><span>         </span><span class="hs-special">,</span><span> </span><span id="sig_inst_skols"><span class="annot"><span class="annottext">TcIdSigInst -&gt; [(Name, InvisTVBinder)]
</span><a href="GHC.Tc.Types.html#sig_inst_skols"><span class="hs-identifier hs-var hs-var">sig_inst_skols</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#InvisTVBinder"><span class="hs-identifier hs-type">InvisTVBinder</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1540"></span><span>               </span><span class="hs-comment">-- Instantiated type and kind variables, TyVarTvs</span><span>
</span><span id="line-1541"></span><span>               </span><span class="hs-comment">-- The Name is the Name that the renamer chose;</span><span>
</span><span id="line-1542"></span><span>               </span><span class="hs-comment">--   but the TcTyVar may come from instantiating</span><span>
</span><span id="line-1543"></span><span>               </span><span class="hs-comment">--   the type and hence have a different unique.</span><span>
</span><span id="line-1544"></span><span>               </span><span class="hs-comment">-- No need to keep track of whether they are truly lexically</span><span>
</span><span id="line-1545"></span><span>               </span><span class="hs-comment">--   scoped because the renamer has named them uniquely</span><span>
</span><span id="line-1546"></span><span>               </span><span class="hs-comment">-- See Note [Binding scoped type variables] in GHC.Tc.Gen.Sig</span><span>
</span><span id="line-1547"></span><span>               </span><span class="hs-comment">--</span><span>
</span><span id="line-1548"></span><span>               </span><span class="hs-comment">-- NB: The order of sig_inst_skols is irrelevant</span><span>
</span><span id="line-1549"></span><span>               </span><span class="hs-comment">--     for a CompleteSig, but for a PartialSig see</span><span>
</span><span id="line-1550"></span><span>               </span><span class="hs-comment">--     Note [Quantified variables in partial type signatures]</span><span>
</span><span id="line-1551"></span><span>
</span><span id="line-1552"></span><span>         </span><span class="hs-special">,</span><span> </span><span id="sig_inst_theta"><span class="annot"><span class="annottext">TcIdSigInst -&gt; [Type]
</span><a href="GHC.Tc.Types.html#sig_inst_theta"><span class="hs-identifier hs-var hs-var">sig_inst_theta</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span>
</span><span id="line-1553"></span><span>               </span><span class="hs-comment">-- Instantiated theta.  In the case of a</span><span>
</span><span id="line-1554"></span><span>               </span><span class="hs-comment">-- PartialSig, sig_theta does not include</span><span>
</span><span id="line-1555"></span><span>               </span><span class="hs-comment">-- the extra-constraints wildcard</span><span>
</span><span id="line-1556"></span><span>
</span><span id="line-1557"></span><span>         </span><span class="hs-special">,</span><span> </span><span id="sig_inst_tau"><span class="annot"><span class="annottext">TcIdSigInst -&gt; Type
</span><a href="GHC.Tc.Types.html#sig_inst_tau"><span class="hs-identifier hs-var hs-var">sig_inst_tau</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span>   </span><span class="hs-comment">-- Instantiated tau</span><span>
</span><span id="line-1558"></span><span>               </span><span class="hs-comment">-- See Note [sig_inst_tau may be polymorphic]</span><span>
</span><span id="line-1559"></span><span>
</span><span id="line-1560"></span><span>         </span><span class="hs-comment">-- Relevant for partial signature only</span><span>
</span><span id="line-1561"></span><span>         </span><span class="hs-special">,</span><span> </span><span id="sig_inst_wcs"><span class="annot"><span class="annottext">TcIdSigInst -&gt; [(Name, TyVar)]
</span><a href="GHC.Tc.Types.html#sig_inst_wcs"><span class="hs-identifier hs-var hs-var">sig_inst_wcs</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1562"></span><span>               </span><span class="hs-comment">-- Like sig_inst_skols, but for /named/ wildcards (_a etc).</span><span>
</span><span id="line-1563"></span><span>               </span><span class="hs-comment">-- The named wildcards scope over the binding, and hence</span><span>
</span><span id="line-1564"></span><span>               </span><span class="hs-comment">-- their Names may appear in type signatures in the binding</span><span>
</span><span id="line-1565"></span><span>
</span><span id="line-1566"></span><span>         </span><span class="hs-special">,</span><span> </span><span id="sig_inst_wcx"><span class="annot"><span class="annottext">TcIdSigInst -&gt; Maybe Type
</span><a href="GHC.Tc.Types.html#sig_inst_wcx"><span class="hs-identifier hs-var hs-var">sig_inst_wcx</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>
</span><span id="line-1567"></span><span>               </span><span class="hs-comment">-- Extra-constraints wildcard to fill in, if any</span><span>
</span><span id="line-1568"></span><span>               </span><span class="hs-comment">-- If this exists, it is surely of the form (meta_tv |&gt; co)</span><span>
</span><span id="line-1569"></span><span>               </span><span class="hs-comment">-- (where the co might be reflexive). This is filled in</span><span>
</span><span id="line-1570"></span><span>               </span><span class="hs-comment">-- only from the return value of GHC.Tc.Gen.HsType.tcAnonWildCardOcc</span><span>
</span><span id="line-1571"></span><span>         </span><span class="hs-special">}</span><span>
</span><span id="line-1572"></span><span>
</span><span id="line-1573"></span><span class="hs-comment">{- Note [sig_inst_tau may be polymorphic]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note that &quot;sig_inst_tau&quot; might actually be a polymorphic type,
if the original function had a signature like
   forall a. Eq a =&gt; forall b. Ord b =&gt; ....
But that's ok: tcMatchesFun (called by tcRhs) can deal with that
It happens, too!  See Note [Polymorphic methods] in GHC.Tc.TyCl.Class.

Note [Quantified variables in partial type signatures]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
   f :: forall a b. _ -&gt; a -&gt; _ -&gt; b
   f (x,y) p q = q

Then we expect f's final type to be
  f :: forall {x,y}. forall a b. (x,y) -&gt; a -&gt; b -&gt; b

Note that x,y are Inferred, and can't be use for visible type
application (VTA).  But a,b are Specified, and remain Specified
in the final type, so we can use VTA for them.  (Exception: if
it turns out that a's kind mentions b we need to reorder them
with scopedSort.)

The sig_inst_skols of the TISI from a partial signature records
that original order, and is used to get the variables of f's
final type in the correct order.


Note [Wildcards in partial signatures]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The wildcards in psig_wcs may stand for a type mentioning
the universally-quantified tyvars of psig_ty

E.g.  f :: forall a. _ -&gt; a
      f x = x
We get sig_inst_skols = [a]
       sig_inst_tau   = _22 -&gt; a
       sig_inst_wcs   = [_22]
and _22 in the end is unified with the type 'a'

Moreover the kind of a wildcard in sig_inst_wcs may mention
the universally-quantified tyvars sig_inst_skols
e.g.   f :: t a -&gt; t _
Here we get
   sig_inst_skols = [k:*, (t::k -&gt;*), (a::k)]
   sig_inst_tau   = t a -&gt; t _22
   sig_inst_wcs   = [ _22::k ]
-}</span><span>
</span><span id="line-1621"></span><span>
</span><span id="line-1622"></span><span class="hs-keyword">data</span><span> </span><span id="TcPatSynInfo"><span class="annot"><a href="GHC.Tc.Types.html#TcPatSynInfo"><span class="hs-identifier hs-var">TcPatSynInfo</span></a></span></span><span>
</span><span id="line-1623"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="TPSI"><span class="annot"><a href="GHC.Tc.Types.html#TPSI"><span class="hs-identifier hs-var">TPSI</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-1624"></span><span>        </span><span id="patsig_name"><span class="annot"><span class="annottext">TcPatSynInfo -&gt; Name
</span><a href="GHC.Tc.Types.html#patsig_name"><span class="hs-identifier hs-var hs-var">patsig_name</span></a></span></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1625"></span><span>        </span><span id="patsig_implicit_bndrs"><span class="annot"><span class="annottext">TcPatSynInfo -&gt; [InvisTVBinder]
</span><a href="GHC.Tc.Types.html#patsig_implicit_bndrs"><span class="hs-identifier hs-var hs-var">patsig_implicit_bndrs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#InvisTVBinder"><span class="hs-identifier hs-type">InvisTVBinder</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- Implicitly-bound kind vars (Inferred) and</span><span>
</span><span id="line-1626"></span><span>                                                  </span><span class="hs-comment">-- implicitly-bound type vars (Specified)</span><span>
</span><span id="line-1627"></span><span>          </span><span class="hs-comment">-- See Note [The pattern-synonym signature splitting rule] in GHC.Tc.TyCl.PatSyn</span><span>
</span><span id="line-1628"></span><span>        </span><span id="patsig_univ_bndrs"><span class="annot"><span class="annottext">TcPatSynInfo -&gt; [InvisTVBinder]
</span><a href="GHC.Tc.Types.html#patsig_univ_bndrs"><span class="hs-identifier hs-var hs-var">patsig_univ_bndrs</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#InvisTVBinder"><span class="hs-identifier hs-type">InvisTVBinder</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- Bound by explicit user forall</span><span>
</span><span id="line-1629"></span><span>        </span><span id="patsig_req"><span class="annot"><span class="annottext">TcPatSynInfo -&gt; [Type]
</span><a href="GHC.Tc.Types.html#patsig_req"><span class="hs-identifier hs-var hs-var">patsig_req</span></a></span></span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1630"></span><span>        </span><span id="patsig_ex_bndrs"><span class="annot"><span class="annottext">TcPatSynInfo -&gt; [InvisTVBinder]
</span><a href="GHC.Tc.Types.html#patsig_ex_bndrs"><span class="hs-identifier hs-var hs-var">patsig_ex_bndrs</span></a></span></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#InvisTVBinder"><span class="hs-identifier hs-type">InvisTVBinder</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- Bound by explicit user forall</span><span>
</span><span id="line-1631"></span><span>        </span><span id="patsig_prov"><span class="annot"><span class="annottext">TcPatSynInfo -&gt; [Type]
</span><a href="GHC.Tc.Types.html#patsig_prov"><span class="hs-identifier hs-var hs-var">patsig_prov</span></a></span></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1632"></span><span>        </span><span id="patsig_body_ty"><span class="annot"><span class="annottext">TcPatSynInfo -&gt; Type
</span><a href="GHC.Tc.Types.html#patsig_body_ty"><span class="hs-identifier hs-var hs-var">patsig_body_ty</span></a></span></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span>
</span><span id="line-1633"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-1634"></span><span>
</span><span id="line-1635"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879542"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigInfo"><span class="hs-identifier hs-type">TcSigInfo</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1636"></span><span>  </span><span id="local-6989586621680879539"><span class="annot"><span class="annottext">ppr :: TcSigInfo -&gt; SDoc
</span><a href="#local-6989586621680879539"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSig"><span class="hs-identifier hs-type">TcIdSig</span></a></span><span>     </span><span id="local-6989586621680879538"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621680879538"><span class="hs-identifier hs-var">idsi</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621680879538"><span class="hs-identifier hs-var">idsi</span></a></span><span>
</span><span id="line-1637"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcPatSynSig"><span class="hs-identifier hs-type">TcPatSynSig</span></a></span><span> </span><span id="local-6989586621680879537"><span class="annot"><span class="annottext">TcPatSynInfo
</span><a href="#local-6989586621680879537"><span class="hs-identifier hs-var">tpsi</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;TcPatSynInfo&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcPatSynInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcPatSynInfo
</span><a href="#local-6989586621680879537"><span class="hs-identifier hs-var">tpsi</span></a></span><span>
</span><span id="line-1638"></span><span>
</span><span id="line-1639"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879534"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInfo"><span class="hs-identifier hs-type">TcIdSigInfo</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1640"></span><span>    </span><span id="local-6989586621680879513"><span class="annot"><span class="annottext">ppr :: TcIdSigInfo -&gt; SDoc
</span><a href="#local-6989586621680879513"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#CompleteSig"><span class="hs-identifier hs-type">CompleteSig</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sig_bndr :: TcIdSigInfo -&gt; TyVar
</span><a href="GHC.Tc.Types.html#sig_bndr"><span class="hs-identifier hs-var">sig_bndr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879512"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879512"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1641"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879512"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar -&gt; Type
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621680879512"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1642"></span><span>    </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#PartialSig"><span class="hs-identifier hs-type">PartialSig</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">psig_name :: TcIdSigInfo -&gt; Name
</span><a href="GHC.Tc.Types.html#psig_name"><span class="hs-identifier hs-var">psig_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879511"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879511"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">psig_hs_ty :: TcIdSigInfo -&gt; LHsSigWcType GhcRn
</span><a href="GHC.Tc.Types.html#psig_hs_ty"><span class="hs-identifier hs-var">psig_hs_ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879510"><span class="annot"><span class="annottext">LHsSigWcType GhcRn
</span><a href="#local-6989586621680879510"><span class="hs-identifier hs-var">hs_ty</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1643"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;psig&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879511"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigWcType GhcRn -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigWcType GhcRn
</span><a href="#local-6989586621680879510"><span class="hs-identifier hs-var">hs_ty</span></a></span><span>
</span><span id="line-1644"></span><span>
</span><span id="line-1645"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879507"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier hs-type">TcIdSigInst</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1646"></span><span>    </span><span id="local-6989586621680879494"><span class="annot"><span class="annottext">ppr :: TcIdSigInst -&gt; SDoc
</span><a href="#local-6989586621680879494"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TISI"><span class="hs-identifier hs-type">TISI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sig_inst_sig :: TcIdSigInst -&gt; TcIdSigInfo
</span><a href="GHC.Tc.Types.html#sig_inst_sig"><span class="hs-identifier hs-var">sig_inst_sig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879493"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621680879493"><span class="hs-identifier hs-var">sig</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">sig_inst_skols :: TcIdSigInst -&gt; [(Name, InvisTVBinder)]
</span><a href="GHC.Tc.Types.html#sig_inst_skols"><span class="hs-identifier hs-var">sig_inst_skols</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879492"><span class="annot"><span class="annottext">[(Name, InvisTVBinder)]
</span><a href="#local-6989586621680879492"><span class="hs-identifier hs-var">skols</span></a></span></span><span>
</span><span id="line-1647"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">sig_inst_theta :: TcIdSigInst -&gt; [Type]
</span><a href="GHC.Tc.Types.html#sig_inst_theta"><span class="hs-identifier hs-var">sig_inst_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879491"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680879491"><span class="hs-identifier hs-var">theta</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">sig_inst_tau :: TcIdSigInst -&gt; Type
</span><a href="GHC.Tc.Types.html#sig_inst_tau"><span class="hs-identifier hs-var">sig_inst_tau</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879490"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680879490"><span class="hs-identifier hs-var">tau</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1648"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; ThLevel -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcIdSigInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621680879493"><span class="hs-identifier hs-var">sig</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ThLevel
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">[(Name, InvisTVBinder)] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, InvisTVBinder)]
</span><a href="#local-6989586621680879492"><span class="hs-identifier hs-var">skols</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680879491"><span class="hs-identifier hs-var">theta</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#darrow"><span class="hs-identifier hs-var">darrow</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680879490"><span class="hs-identifier hs-var">tau</span></a></span><span> </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1649"></span><span>
</span><span id="line-1650"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879484"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPatSynInfo"><span class="hs-identifier hs-type">TcPatSynInfo</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1651"></span><span>    </span><span id="local-6989586621680879482"><span class="annot"><span class="annottext">ppr :: TcPatSynInfo -&gt; SDoc
</span><a href="#local-6989586621680879482"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TPSI"><span class="hs-identifier hs-type">TPSI</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">patsig_name :: TcPatSynInfo -&gt; Name
</span><a href="GHC.Tc.Types.html#patsig_name"><span class="hs-identifier hs-var">patsig_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680879481"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879481"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879481"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1652"></span><span>
</span><span id="line-1653"></span><span class="annot"><a href="GHC.Tc.Types.html#isPartialSig"><span class="hs-identifier hs-type">isPartialSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier hs-type">TcIdSigInst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1654"></span><span id="isPartialSig"><span class="annot"><span class="annottext">isPartialSig :: TcIdSigInst -&gt; Bool
</span><a href="GHC.Tc.Types.html#isPartialSig"><span class="hs-identifier hs-var hs-var">isPartialSig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TISI"><span class="hs-identifier hs-type">TISI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sig_inst_sig :: TcIdSigInst -&gt; TcIdSigInfo
</span><a href="GHC.Tc.Types.html#sig_inst_sig"><span class="hs-identifier hs-var">sig_inst_sig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#PartialSig"><span class="hs-identifier hs-type">PartialSig</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1655"></span><span class="annot"><a href="GHC.Tc.Types.html#isPartialSig"><span class="hs-identifier hs-var">isPartialSig</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInst
</span><span class="hs-identifier">_</span></span><span>                                       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1656"></span><span>
</span><span id="line-1657"></span><span class="hs-comment">-- | No signature or a partial signature</span><span>
</span><span id="line-1658"></span><span class="annot"><a href="GHC.Tc.Types.html#hasCompleteSig"><span class="hs-identifier hs-type">hasCompleteSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1659"></span><span id="hasCompleteSig"><span class="annot"><span class="annottext">hasCompleteSig :: TcSigFun -&gt; Name -&gt; Bool
</span><a href="GHC.Tc.Types.html#hasCompleteSig"><span class="hs-identifier hs-var hs-var">hasCompleteSig</span></a></span></span><span> </span><span id="local-6989586621680879480"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621680879480"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621680879479"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879479"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-1660"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621680879480"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879479"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1661"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSig"><span class="hs-identifier hs-type">TcIdSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#CompleteSig"><span class="hs-identifier hs-type">CompleteSig</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1662"></span><span>      </span><span class="annot"><span class="annottext">Maybe TcSigInfo
</span><span class="hs-identifier">_</span></span><span>                               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1663"></span><span>
</span><span id="line-1664"></span><span>
</span><span id="line-1665"></span><span class="hs-comment">{-
Constraint Solver Plugins
-------------------------
-}</span><span>
</span><span id="line-1669"></span><span>
</span><span id="line-1670"></span><span class="hs-keyword">type</span><span> </span><span id="TcPluginSolver"><span class="annot"><a href="GHC.Tc.Types.html#TcPluginSolver"><span class="hs-identifier hs-var">TcPluginSolver</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span class="hs-special">]</span><span>    </span><span class="hs-comment">-- given</span><span>
</span><span id="line-1671"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span class="hs-special">]</span><span>    </span><span class="hs-comment">-- derived</span><span>
</span><span id="line-1672"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span class="hs-special">]</span><span>    </span><span class="hs-comment">-- wanted</span><span>
</span><span id="line-1673"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-type">TcPluginM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginResult"><span class="hs-identifier hs-type">TcPluginResult</span></a></span><span>
</span><span id="line-1674"></span><span>
</span><span id="line-1675"></span><span class="hs-keyword">newtype</span><span> </span><span id="TcPluginM"><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-var">TcPluginM</span></a></span></span><span> </span><span id="local-6989586621680880119"><span class="annot"><a href="#local-6989586621680880119"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="TcPluginM"><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-var">TcPluginM</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#EvBindsVar"><span class="hs-identifier hs-type">EvBindsVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680880119"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680879472"><span id="local-6989586621680879475"><span class="annot"><span class="annottext">(forall a b. (a -&gt; b) -&gt; TcPluginM a -&gt; TcPluginM b)
-&gt; (forall a b. a -&gt; TcPluginM b -&gt; TcPluginM a)
-&gt; Functor TcPluginM
forall a b. a -&gt; TcPluginM b -&gt; TcPluginM a
forall a b. (a -&gt; b) -&gt; TcPluginM a -&gt; TcPluginM b
forall (f :: * -&gt; *).
(forall a b. (a -&gt; b) -&gt; f a -&gt; f b)
-&gt; (forall a b. a -&gt; f b -&gt; f a) -&gt; Functor f
&lt;$ :: forall a b. a -&gt; TcPluginM b -&gt; TcPluginM a
$c&lt;$ :: forall a b. a -&gt; TcPluginM b -&gt; TcPluginM a
fmap :: forall a b. (a -&gt; b) -&gt; TcPluginM a -&gt; TcPluginM b
$cfmap :: forall a b. (a -&gt; b) -&gt; TcPluginM a -&gt; TcPluginM b
</span><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Functor</span></a></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-1676"></span><span>
</span><span id="line-1677"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879459"><span id="local-6989586621680879461"><span id="local-6989586621680879463"><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-type">TcPluginM</span></a></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1678"></span><span>  </span><span id="local-6989586621680879455"><span class="annot"><span class="annottext">pure :: forall a. a -&gt; TcPluginM a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var hs-var hs-var hs-var">pure</span></a></span></span><span> </span><span id="local-6989586621680879454"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680879454"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(EvBindsVar -&gt; TcM a) -&gt; TcPluginM a
forall a. (EvBindsVar -&gt; TcM a) -&gt; TcPluginM a
</span><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-var">TcPluginM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcM a -&gt; EvBindsVar -&gt; TcM a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM a -&gt; EvBindsVar -&gt; TcM a) -&gt; TcM a -&gt; EvBindsVar -&gt; TcM a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; TcM a
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680879454"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1679"></span><span>  </span><span id="local-6989586621680879451"><span class="annot"><span class="annottext">&lt;*&gt; :: forall a b. TcPluginM (a -&gt; b) -&gt; TcPluginM a -&gt; TcPluginM b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">(&lt;*&gt;)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcPluginM (a -&gt; b) -&gt; TcPluginM a -&gt; TcPluginM b
forall (m :: * -&gt; *) a b. Monad m =&gt; m (a -&gt; b) -&gt; m a -&gt; m b
</span><a href="../../base/src/GHC.Base.html#ap"><span class="hs-identifier hs-var">ap</span></a></span><span>
</span><span id="line-1680"></span><span>
</span><span id="line-1681"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680879444"><span id="local-6989586621680879446"><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-type">TcPluginM</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1682"></span><span>  </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-type">TcPluginM</span></a></span><span> </span><span id="local-6989586621680879441"><span class="annot"><span class="annottext">EvBindsVar -&gt; TcM a
</span><a href="#local-6989586621680879441"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621680879440"><span class="annot"><span class="annottext">&gt;&gt;= :: forall a b. TcPluginM a -&gt; (a -&gt; TcPluginM b) -&gt; TcPluginM b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">&gt;&gt;=</span></a></span></span><span> </span><span id="local-6989586621680879439"><span class="annot"><span class="annottext">a -&gt; TcPluginM b
</span><a href="#local-6989586621680879439"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1683"></span><span>    </span><span class="annot"><span class="annottext">(EvBindsVar -&gt; TcM b) -&gt; TcPluginM b
forall a. (EvBindsVar -&gt; TcM a) -&gt; TcPluginM a
</span><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-var">TcPluginM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680879438"><span class="annot"><span class="annottext">EvBindsVar
</span><a href="#local-6989586621680879438"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680879437"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680879437"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">EvBindsVar -&gt; TcM a
</span><a href="#local-6989586621680879441"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">EvBindsVar
</span><a href="#local-6989586621680879438"><span class="hs-identifier hs-var">ev</span></a></span><span>
</span><span id="line-1684"></span><span>                          </span><span class="annot"><span class="annottext">TcPluginM b -&gt; EvBindsVar -&gt; TcM b
forall a. TcPluginM a -&gt; EvBindsVar -&gt; TcM a
</span><a href="GHC.Tc.Types.html#runTcPluginM"><span class="hs-identifier hs-var">runTcPluginM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; TcPluginM b
</span><a href="#local-6989586621680879439"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680879437"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">EvBindsVar
</span><a href="#local-6989586621680879438"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1685"></span><span>
</span><span id="line-1686"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#MonadFail"><span class="hs-identifier hs-type">MonadFail</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-type">TcPluginM</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1687"></span><span>  </span><span id="local-6989586621680879429"><span class="annot"><span class="annottext">fail :: forall a. FilePath -&gt; TcPluginM a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var hs-var hs-var hs-var">fail</span></a></span></span><span> </span><span id="local-6989586621680879428"><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621680879428"><span class="hs-identifier hs-var">x</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(EvBindsVar -&gt; TcM a) -&gt; TcPluginM a
forall a. (EvBindsVar -&gt; TcM a) -&gt; TcPluginM a
</span><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-var">TcPluginM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcM a -&gt; EvBindsVar -&gt; TcM a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM a -&gt; EvBindsVar -&gt; TcM a) -&gt; TcM a -&gt; EvBindsVar -&gt; TcM a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; TcM a
forall (m :: * -&gt; *) a. MonadFail m =&gt; FilePath -&gt; m a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var">fail</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621680879428"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1688"></span><span>
</span><span id="line-1689"></span><span id="local-6989586621680880103"><span class="annot"><a href="GHC.Tc.Types.html#runTcPluginM"><span class="hs-identifier hs-type">runTcPluginM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-type">TcPluginM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680880103"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#EvBindsVar"><span class="hs-identifier hs-type">EvBindsVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680880103"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1690"></span><span id="runTcPluginM"><span class="annot"><span class="annottext">runTcPluginM :: forall a. TcPluginM a -&gt; EvBindsVar -&gt; TcM a
</span><a href="GHC.Tc.Types.html#runTcPluginM"><span class="hs-identifier hs-var hs-var">runTcPluginM</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-type">TcPluginM</span></a></span><span> </span><span id="local-6989586621680879427"><span class="annot"><span class="annottext">EvBindsVar -&gt; TcM a
</span><a href="#local-6989586621680879427"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EvBindsVar -&gt; TcM a
</span><a href="#local-6989586621680879427"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1691"></span><span>
</span><span id="line-1692"></span><span class="hs-comment">-- | This function provides an escape for direct access to</span><span>
</span><span id="line-1693"></span><span class="hs-comment">-- the 'TcM` monad.  It should not be used lightly, and</span><span>
</span><span id="line-1694"></span><span class="hs-comment">-- the provided 'TcPluginM' API should be favoured instead.</span><span>
</span><span id="line-1695"></span><span id="local-6989586621680880097"><span class="annot"><a href="GHC.Tc.Types.html#unsafeTcPluginTcM"><span class="hs-identifier hs-type">unsafeTcPluginTcM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680880097"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-type">TcPluginM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680880097"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1696"></span><span id="unsafeTcPluginTcM"><span class="annot"><span class="annottext">unsafeTcPluginTcM :: forall a. TcM a -&gt; TcPluginM a
</span><a href="GHC.Tc.Types.html#unsafeTcPluginTcM"><span class="hs-identifier hs-var hs-var">unsafeTcPluginTcM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(EvBindsVar -&gt; TcM a) -&gt; TcPluginM a
forall a. (EvBindsVar -&gt; TcM a) -&gt; TcPluginM a
</span><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-var">TcPluginM</span></a></span><span> </span><span class="annot"><span class="annottext">((EvBindsVar -&gt; TcM a) -&gt; TcPluginM a)
-&gt; (TcM a -&gt; EvBindsVar -&gt; TcM a) -&gt; TcM a -&gt; TcPluginM a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a -&gt; EvBindsVar -&gt; TcM a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span>
</span><span id="line-1697"></span><span>
</span><span id="line-1698"></span><span class="hs-comment">-- | Access the 'EvBindsVar' carried by the 'TcPluginM' during</span><span>
</span><span id="line-1699"></span><span class="hs-comment">-- constraint solving.  Returns 'Nothing' if invoked during</span><span>
</span><span id="line-1700"></span><span class="hs-comment">-- 'tcPluginInit' or 'tcPluginStop'.</span><span>
</span><span id="line-1701"></span><span class="annot"><a href="GHC.Tc.Types.html#getEvBindsTcPluginM"><span class="hs-identifier hs-type">getEvBindsTcPluginM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-type">TcPluginM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#EvBindsVar"><span class="hs-identifier hs-type">EvBindsVar</span></a></span><span>
</span><span id="line-1702"></span><span id="getEvBindsTcPluginM"><span class="annot"><span class="annottext">getEvBindsTcPluginM :: TcPluginM EvBindsVar
</span><a href="GHC.Tc.Types.html#getEvBindsTcPluginM"><span class="hs-identifier hs-var hs-var">getEvBindsTcPluginM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(EvBindsVar -&gt; TcM EvBindsVar) -&gt; TcPluginM EvBindsVar
forall a. (EvBindsVar -&gt; TcM a) -&gt; TcPluginM a
</span><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-var">TcPluginM</span></a></span><span> </span><span class="annot"><span class="annottext">EvBindsVar -&gt; TcM EvBindsVar
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>
</span><span id="line-1703"></span><span>
</span><span id="line-1704"></span><span>
</span><span id="line-1705"></span><span class="hs-keyword">data</span><span> </span><span id="TcPlugin"><span class="annot"><a href="GHC.Tc.Types.html#TcPlugin"><span class="hs-identifier hs-var">TcPlugin</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680879426"><span class="annot"><a href="#local-6989586621680879426"><span class="hs-identifier hs-type">s</span></a></span></span><span class="hs-operator">.</span><span> </span><span id="TcPlugin"><span class="annot"><a href="GHC.Tc.Types.html#TcPlugin"><span class="hs-identifier hs-var">TcPlugin</span></a></span></span><span>
</span><span id="line-1706"></span><span>  </span><span class="hs-special">{</span><span> </span><span id="tcPluginInit"><span class="annot"><span class="annottext">()
</span><a href="GHC.Tc.Types.html#tcPluginInit"><span class="hs-identifier hs-var hs-var">tcPluginInit</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-type">TcPluginM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680879426"><span class="hs-identifier hs-type">s</span></a></span><span>
</span><span id="line-1707"></span><span>    </span><span class="hs-comment">-- ^ Initialize plugin, when entering type-checker.</span><span>
</span><span id="line-1708"></span><span>
</span><span id="line-1709"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="tcPluginSolve"><span class="annot"><span class="annottext">()
</span><a href="GHC.Tc.Types.html#tcPluginSolve"><span class="hs-identifier hs-var hs-var">tcPluginSolve</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680879426"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginSolver"><span class="hs-identifier hs-type">TcPluginSolver</span></a></span><span>
</span><span id="line-1710"></span><span>    </span><span class="hs-comment">-- ^ Solve some constraints.</span><span>
</span><span id="line-1711"></span><span>    </span><span class="hs-comment">-- TODO: WRITE MORE DETAILS ON HOW THIS WORKS.</span><span>
</span><span id="line-1712"></span><span>
</span><span id="line-1713"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="tcPluginStop"><span class="annot"><span class="annottext">()
</span><a href="GHC.Tc.Types.html#tcPluginStop"><span class="hs-identifier hs-var hs-var">tcPluginStop</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680879426"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcPluginM"><span class="hs-identifier hs-type">TcPluginM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1714"></span><span>   </span><span class="hs-comment">-- ^ Clean up after the plugin, when exiting the type-checker.</span><span>
</span><span id="line-1715"></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-1716"></span><span>
</span><span id="line-1717"></span><span class="hs-keyword">data</span><span> </span><span id="TcPluginResult"><span class="annot"><a href="GHC.Tc.Types.html#TcPluginResult"><span class="hs-identifier hs-var">TcPluginResult</span></a></span></span><span>
</span><span id="line-1718"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="TcPluginContradiction"><span class="annot"><a href="GHC.Tc.Types.html#TcPluginContradiction"><span class="hs-identifier hs-var">TcPluginContradiction</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1719"></span><span>    </span><span class="hs-comment">-- ^ The plugin found a contradiction.</span><span>
</span><span id="line-1720"></span><span>    </span><span class="hs-comment">-- The returned constraints are removed from the inert set,</span><span>
</span><span id="line-1721"></span><span>    </span><span class="hs-comment">-- and recorded as insoluble.</span><span>
</span><span id="line-1722"></span><span>
</span><span id="line-1723"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="TcPluginOk"><span class="annot"><a href="GHC.Tc.Types.html#TcPluginOk"><span class="hs-identifier hs-var">TcPluginOk</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#EvTerm"><span class="hs-identifier hs-type">EvTerm</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1724"></span><span>    </span><span class="hs-comment">-- ^ The first field is for constraints that were solved.</span><span>
</span><span id="line-1725"></span><span>    </span><span class="hs-comment">-- These are removed from the inert set,</span><span>
</span><span id="line-1726"></span><span>    </span><span class="hs-comment">-- and the evidence for them is recorded.</span><span>
</span><span id="line-1727"></span><span>    </span><span class="hs-comment">-- The second field contains new work, that should be processed by</span><span>
</span><span id="line-1728"></span><span>    </span><span class="hs-comment">-- the constraint solver.</span><span>
</span><span id="line-1729"></span><span>
</span><span id="line-1730"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                        Role annotations
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1735"></span><span>
</span><span id="line-1736"></span><span class="hs-keyword">type</span><span> </span><span id="RoleAnnotEnv"><span class="annot"><a href="GHC.Tc.Types.html#RoleAnnotEnv"><span class="hs-identifier hs-var">RoleAnnotEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#LRoleAnnotDecl"><span class="hs-identifier hs-type">LRoleAnnotDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1737"></span><span>
</span><span id="line-1738"></span><span class="annot"><a href="GHC.Tc.Types.html#mkRoleAnnotEnv"><span class="hs-identifier hs-type">mkRoleAnnotEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LRoleAnnotDecl"><span class="hs-identifier hs-type">LRoleAnnotDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RoleAnnotEnv"><span class="hs-identifier hs-type">RoleAnnotEnv</span></a></span><span>
</span><span id="line-1739"></span><span id="mkRoleAnnotEnv"><span class="annot"><span class="annottext">mkRoleAnnotEnv :: [LRoleAnnotDecl GhcRn] -&gt; RoleAnnotEnv
</span><a href="GHC.Tc.Types.html#mkRoleAnnotEnv"><span class="hs-identifier hs-var hs-var">mkRoleAnnotEnv</span></a></span></span><span> </span><span id="local-6989586621680879418"><span class="annot"><span class="annottext">[LRoleAnnotDecl GhcRn]
</span><a href="#local-6989586621680879418"><span class="hs-identifier hs-var">role_annot_decls</span></a></span></span><span>
</span><span id="line-1740"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, LRoleAnnotDecl GhcRn)] -&gt; RoleAnnotEnv
forall a. [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#mkNameEnv"><span class="hs-identifier hs-var">mkNameEnv</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879416"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LRoleAnnotDecl GhcRn
</span><a href="#local-6989586621680879415"><span class="hs-identifier hs-var">ra_decl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1741"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680879415"><span class="annot"><span class="annottext">LRoleAnnotDecl GhcRn
</span><a href="#local-6989586621680879415"><span class="hs-identifier hs-var">ra_decl</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LRoleAnnotDecl GhcRn]
</span><a href="#local-6989586621680879418"><span class="hs-identifier hs-var">role_annot_decls</span></a></span><span>
</span><span id="line-1742"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680879416"><span class="annot"><span class="annottext">name :: IdP GhcRn
</span><a href="#local-6989586621680879416"><span class="hs-identifier hs-var hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RoleAnnotDecl GhcRn -&gt; IdP GhcRn
forall (p :: Pass). RoleAnnotDecl (GhcPass p) -&gt; IdP (GhcPass p)
</span><a href="GHC.Hs.Decls.html#roleAnnotDeclName"><span class="hs-identifier hs-var">roleAnnotDeclName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LRoleAnnotDecl GhcRn -&gt; RoleAnnotDecl GhcRn
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">LRoleAnnotDecl GhcRn
</span><a href="#local-6989586621680879415"><span class="hs-identifier hs-var">ra_decl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1743"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Builtin.Names.html#isUnboundName"><span class="hs-identifier hs-var">isUnboundName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680879416"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1744"></span><span>       </span><span class="hs-comment">-- Some of the role annots will be unbound;</span><span>
</span><span id="line-1745"></span><span>       </span><span class="hs-comment">-- we don't wish to include these</span><span>
</span><span id="line-1746"></span><span>
</span><span id="line-1747"></span><span class="annot"><a href="GHC.Tc.Types.html#emptyRoleAnnotEnv"><span class="hs-identifier hs-type">emptyRoleAnnotEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RoleAnnotEnv"><span class="hs-identifier hs-type">RoleAnnotEnv</span></a></span><span>
</span><span id="line-1748"></span><span id="emptyRoleAnnotEnv"><span class="annot"><span class="annottext">emptyRoleAnnotEnv :: RoleAnnotEnv
</span><a href="GHC.Tc.Types.html#emptyRoleAnnotEnv"><span class="hs-identifier hs-var hs-var">emptyRoleAnnotEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RoleAnnotEnv
forall a. NameEnv a
</span><a href="GHC.Types.Name.Env.html#emptyNameEnv"><span class="hs-identifier hs-var">emptyNameEnv</span></a></span><span>
</span><span id="line-1749"></span><span>
</span><span id="line-1750"></span><span class="annot"><a href="GHC.Tc.Types.html#lookupRoleAnnot"><span class="hs-identifier hs-type">lookupRoleAnnot</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RoleAnnotEnv"><span class="hs-identifier hs-type">RoleAnnotEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#LRoleAnnotDecl"><span class="hs-identifier hs-type">LRoleAnnotDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1751"></span><span id="lookupRoleAnnot"><span class="annot"><span class="annottext">lookupRoleAnnot :: RoleAnnotEnv -&gt; Name -&gt; Maybe (LRoleAnnotDecl GhcRn)
</span><a href="GHC.Tc.Types.html#lookupRoleAnnot"><span class="hs-identifier hs-var hs-var">lookupRoleAnnot</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RoleAnnotEnv -&gt; Name -&gt; Maybe (LRoleAnnotDecl GhcRn)
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span>
</span><span id="line-1752"></span><span>
</span><span id="line-1753"></span><span class="annot"><a href="GHC.Tc.Types.html#getRoleAnnots"><span class="hs-identifier hs-type">getRoleAnnots</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RoleAnnotEnv"><span class="hs-identifier hs-type">RoleAnnotEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LRoleAnnotDecl"><span class="hs-identifier hs-type">LRoleAnnotDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1754"></span><span id="getRoleAnnots"><span class="annot"><span class="annottext">getRoleAnnots :: [Name] -&gt; RoleAnnotEnv -&gt; [LRoleAnnotDecl GhcRn]
</span><a href="GHC.Tc.Types.html#getRoleAnnots"><span class="hs-identifier hs-var hs-var">getRoleAnnots</span></a></span></span><span> </span><span id="local-6989586621680879410"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621680879410"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span> </span><span id="local-6989586621680879409"><span class="annot"><span class="annottext">RoleAnnotEnv
</span><a href="#local-6989586621680879409"><span class="hs-identifier hs-var">role_env</span></a></span></span><span>
</span><span id="line-1755"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Maybe (LRoleAnnotDecl GhcRn))
-&gt; [Name] -&gt; [LRoleAnnotDecl GhcRn]
forall a b. (a -&gt; Maybe b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier hs-var">mapMaybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RoleAnnotEnv -&gt; Name -&gt; Maybe (LRoleAnnotDecl GhcRn)
</span><a href="GHC.Tc.Types.html#lookupRoleAnnot"><span class="hs-identifier hs-var">lookupRoleAnnot</span></a></span><span> </span><span class="annot"><span class="annottext">RoleAnnotEnv
</span><a href="#local-6989586621680879409"><span class="hs-identifier hs-var">role_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621680879410"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-1756"></span><span>
</span><span id="line-1757"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                  Linting a TcGblEnv
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1762"></span><span>
</span><span id="line-1763"></span><span class="hs-comment">-- | Check the 'TcGblEnv' for consistency. Currently, only checks</span><span>
</span><span id="line-1764"></span><span class="hs-comment">-- axioms, but should check other aspects, too.</span><span>
</span><span id="line-1765"></span><span class="annot"><a href="GHC.Tc.Types.html#lintGblEnv"><span class="hs-identifier hs-type">lintGblEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1766"></span><span id="lintGblEnv"><span class="annot"><span class="annottext">lintGblEnv :: DynFlags -&gt; TcGblEnv -&gt; (Bag SDoc, Bag SDoc)
</span><a href="GHC.Tc.Types.html#lintGblEnv"><span class="hs-identifier hs-var hs-var">lintGblEnv</span></a></span></span><span> </span><span id="local-6989586621680879408"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680879408"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680879407"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621680879407"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [CoAxiom Branched] -&gt; (Bag SDoc, Bag SDoc)
</span><a href="GHC.Core.Lint.html#lintAxioms"><span class="hs-identifier hs-var">lintAxioms</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680879408"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">[CoAxiom Branched]
</span><a href="#local-6989586621680879406"><span class="hs-identifier hs-var">axioms</span></a></span><span>
</span><span id="line-1767"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1768"></span><span>    </span><span id="local-6989586621680879406"><span class="annot"><span class="annottext">axioms :: [CoAxiom Branched]
</span><a href="#local-6989586621680879406"><span class="hs-identifier hs-var hs-var">axioms</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TypeEnv -&gt; [CoAxiom Branched]
</span><a href="GHC.Driver.Types.html#typeEnvCoAxioms"><span class="hs-identifier hs-var">typeEnvCoAxioms</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; TypeEnv
</span><a href="GHC.Tc.Types.html#tcg_type_env"><span class="hs-identifier hs-var hs-var">tcg_type_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621680879407"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1769"></span></pre></body></html>